예제 #1
0
    def setUp(self):
        self.image = 'docker://ubuntu:latest'
        self.tmpdir = tempfile.mkdtemp()
        os.environ['SINGULARITY_ROOTFS'] = self.tmpdir
        os.mkdir('%s/.singularity.d' % self.tmpdir)
        from docker.api import DockerApiConnection
        self.client = DockerApiConnection(image=self.image)

        print("\n---START----------------------------------------")
예제 #2
0
    def test_get_token(self):
        '''test_get_token will obtain a token from the Docker registry for a namepspace
        and repo. 
        '''
        from docker.api import DockerApiConnection
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow:1.0.0")        

        print("Case 1: Ask when we don't need token returns None")
        token = client.update_token()
        self.assertEqual(token,None)
예제 #3
0
    def test_get_token(self):
        '''test_get_token will obtain a token from the Docker registry for a namepspace
        and repo. 
        '''
        from docker.api import DockerApiConnection
        client = DockerApiConnection(
            image="gcr.io/tensorflow/tensorflow:1.0.0")

        print("Case 1: Ask when we don't need token returns None")
        token = client.update_token()
        self.assertEqual(token, None)
예제 #4
0
    def test_get_images(self):
        '''test_get_images will obtain a list of images
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Ask for images")
        images = self.client.get_images()
        self.assertTrue(isinstance(images,list))
        self.assertTrue(len(images)>1)

        print("Case 2: Ask for images from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")        
        images = client.get_images()
        self.assertTrue(isinstance(images,list))
        self.assertTrue(len(images)>1)
예제 #5
0
    def test_get_images(self):
        '''test_get_images will obtain a list of images
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Ask for images")
        images = self.client.get_images()
        self.assertTrue(isinstance(images, list))
        self.assertTrue(len(images) > 1)

        print("Case 2: Ask for images from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")
        images = client.get_images()
        self.assertTrue(isinstance(images, list))
        self.assertTrue(len(images) > 1)
예제 #6
0
    def test_get_tags(self):
        '''test_get_tags will obtain a list of tags
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Ask for tags from standard %s/%s" %(self.client.namespace,
                                                           self.client.repo_name))
        tags = self.client.get_tags()
        self.assertTrue(isinstance(tags,list))
        self.assertTrue(len(tags)>1)
        [self.assertTrue(x in tags) for x in ['xenial','latest','trusty','yakkety']]

        print("Case 2: Ask for tags from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")        
        tags = client.get_tags()
        self.assertTrue(isinstance(tags,list))
        self.assertTrue(len(tags)>1)
        [self.assertTrue(x in tags) for x in ['latest','latest-gpu']]
예제 #7
0
    def setUp(self):
        self.image = 'docker://ubuntu:latest'
        self.tmpdir = tempfile.mkdtemp()
        os.environ['SINGULARITY_ROOTFS'] = self.tmpdir
        os.mkdir('%s/.singularity.d' % self.tmpdir)
        from docker.api import DockerApiConnection
        self.client = DockerApiConnection(image=self.image)

        print("\n---START----------------------------------------")
예제 #8
0
    def test_create_runscript(self):
        '''test_create_runscript should ensure that a runscript is generated
        with some command
        '''
        from docker.api import DockerApiConnection

        print('Testing creation of runscript')
        from docker.tasks import extract_runscript

        manifest = self.client.get_manifest(old_version=True)

        print("Case 1: Asking for CMD when none defined")        
        default_cmd = 'exec /bin/bash "$@"'
        runscript = extract_runscript(manifest=manifest,
                                     includecmd=True)
        # Commands are always in format exec [] "$@"
        # 'exec echo \'Hello World\' "$@"'
        self.assertTrue(default_cmd in runscript)

        print("Case 2: Asking for ENTRYPOINT when none defined")        
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(default_cmd in runscript)

        client = DockerApiConnection(image="docker://bids/mriqc:0.0.2")        
        manifest = client.get_manifest(old_version=True)

        print("Case 3: Asking for ENTRYPOINT when defined")        
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue('exec /run_mriqc "$@"' in runscript)        

        print("Case 4: Asking for CMD when defined")              
        runscript = extract_runscript(manifest=manifest,
                                      includecmd=True)
        self.assertTrue('exec --help "$@"' in runscript)        

        print("Case 5: Asking for ENTRYPOINT when None, should return CMD")    
        from docker.tasks import get_configs
        client = DockerApiConnection(image="tensorflow/tensorflow:1.0.0")        
        manifest = client.get_manifest(old_version=True)

        configs = get_configs(manifest,['Cmd','Entrypoint'])
        self.assertEqual(configs['Entrypoint'],None)
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(configs['Cmd'] in runscript)
예제 #9
0
    def test_get_tags(self):
        '''test_get_tags will obtain a list of tags
        '''
        from docker.api import DockerApiConnection

        full_name = "%s/%s" % (self.client.namespace, self.client.repo_name)
        print("Case 1: Ask for tags from standard %s" % full_name)
        tags = self.client.get_tags()
        self.assertTrue(isinstance(tags, list))
        self.assertTrue(len(tags) > 1)
        ubuntu_tags = ['xenial', 'latest', 'trusty', 'yakkety']
        [self.assertTrue(x in tags) for x in ubuntu_tags]

        print("Case 2: Ask for tags from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")
        tags = client.get_tags()
        self.assertTrue(isinstance(tags, list))
        self.assertTrue(len(tags) > 1)
        [self.assertTrue(x in tags) for x in ['latest', 'latest-gpu']]
예제 #10
0
    def test_get_manifest(self):
        '''test_get_manifest will obtain a library/repo manifest
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Obtain manifest for %s/%s" %(self.client.namespace,
                                                    self.client.repo_name))

        manifest = self.client.get_manifest()

        # Default tag should be latest
        self.assertTrue("fsLayers" in manifest or "layers" in manifest)

        # Giving a bad tag sould return error
        print("Case 3: Bad tag should print valid tags and exit")
        client = DockerApiConnection(image="ubuntu:mmm.avocado")        
        
        # Should work for custom registries
        print("Case 4: Obtain manifest from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")        
        manifest = client.get_manifest()
        self.assertTrue("fsLayers" in manifest or "layers" in manifest)
예제 #11
0
    def test_get_manifest(self):
        '''test_get_manifest will obtain a library/repo manifest
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Obtain manifest for %s/%s" %
              (self.client.namespace, self.client.repo_name))

        manifest = self.client.get_manifest(old_version=True)

        # Default tag should be latest
        self.assertTrue("fsLayers" in manifest)

        # Giving a bad tag sould return error
        print("Case 3: Bad tag should print valid tags and exit")
        client = DockerApiConnection(image="ubuntu:mmm.avocado")

        # Should work for custom registries
        print("Case 4: Obtain manifest from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")
        manifest = client.get_manifest(old_version=True)
        self.assertTrue("fsLayers" in manifest or "layers" in manifest)
예제 #12
0
    def test_get_manifest(self):
        '''test_get_manifest will obtain a library/repo manifest
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Obtain manifest for %s" % self.client.repo_name)

        manifest = self.client.get_manifest(old_version=True)

        # Default tag should be latest
        self.assertTrue("fsLayers" in manifest)

        # Giving a bad tag sould return error
        print("Case 3: Bad tag should print valid tags and exit")
        client = DockerApiConnection(image="ubuntu:mmm.avocado")
예제 #13
0
    def test_create_runscript(self):
        '''test_create_runscript should ensure that a runscript is generated
        with some command
        '''
        from docker.api import DockerApiConnection

        print('Testing creation of runscript')
        from docker.tasks import extract_runscript

        manifest = self.client.get_manifest(old_version=True)

        print("Case 1: Asking for CMD when none defined")
        default_cmd = 'exec /bin/bash "$@"'
        runscript = extract_runscript(manifest=manifest, includecmd=True)
        # Commands are always in format exec [] "$@"
        # 'exec echo \'Hello World\' "$@"'
        self.assertTrue(default_cmd in runscript)

        print("Case 2: Asking for ENTRYPOINT when none defined")
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(default_cmd in runscript)

        client = DockerApiConnection(image="docker://bids/mriqc:0.0.2")
        manifest = client.get_manifest(old_version=True)

        print("Case 3: Asking for ENTRYPOINT when defined")
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue('exec /run_mriqc "$@"' in runscript)

        print("Case 4: Asking for CMD when defined")
        runscript = extract_runscript(manifest=manifest, includecmd=True)
        self.assertTrue('exec --help "$@"' in runscript)

        print("Case 5: Asking for ENTRYPOINT when None, should return CMD")
        from docker.tasks import get_configs
        client = DockerApiConnection(image="tensorflow/tensorflow:1.0.0")
        manifest = client.get_manifest(old_version=True)

        configs = get_configs(manifest, ['Cmd', 'Entrypoint'])
        self.assertEqual(configs['Entrypoint'], None)
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(configs['Cmd'] in runscript)
예제 #14
0
class TestApi(TestCase):

    def setUp(self):
        self.image = 'docker://ubuntu:latest'
        self.tmpdir = tempfile.mkdtemp()
        os.environ['SINGULARITY_ROOTFS'] = self.tmpdir
        os.mkdir('%s/.singularity.d' % self.tmpdir)
        from docker.api import DockerApiConnection
        self.client = DockerApiConnection(image=self.image)

        print("\n---START----------------------------------------")

    def tearDown(self):
        shutil.rmtree(self.tmpdir)

        print("---END------------------------------------------")

    def test_get_token(self):
        '''test_get_token will obtain a token from
           the Docker registry for a namepspace
           and repo.
        '''
        from docker.api import DockerApiConnection
        docker_image = "gcr.io/tensorflow/tensorflow:1.0.0"
        client = DockerApiConnection(image=docker_image)

        print("Case 1: Ask when we don't need token returns None")
        token = client.update_token()
        self.assertEqual(token, None)

    def test_get_manifest(self):
        '''test_get_manifest will obtain a library/repo manifest
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Obtain manifest for %s/%s" % (self.client.namespace,
                                                     self.client.repo_name))

        manifest = self.client.get_manifest(old_version=True)

        # Default tag should be latest
        self.assertTrue("fsLayers" in manifest)

        # Giving a bad tag sould return error
        print("Case 3: Bad tag should print valid tags and exit")
        client = DockerApiConnection(image="ubuntu:mmm.avocado")

    def test_get_images(self):
        '''test_get_images will obtain a list of images
        '''
        from docker.api import DockerApiConnection

        images = self.client.get_images()
        self.assertTrue(isinstance(images, list))
        self.assertTrue(len(images) > 1)

    def test_get_tags(self):
        '''test_get_tags will obtain a list of tags
        '''
        from docker.api import DockerApiConnection

        full_name = "%s/%s" % (self.client.namespace, self.client.repo_name)
        print("Case 1: Ask for tags from standard %s" % full_name)
        tags = self.client.get_tags()
        self.assertTrue(isinstance(tags, list))
        self.assertTrue(len(tags) > 1)
        ubuntu_tags = ['xenial', 'latest', 'trusty', 'yakkety']
        [self.assertTrue(x in tags) for x in ubuntu_tags]

    def test_get_layer(self):
        '''test_get_layer will download docker layers
        '''
        from docker.api import DockerApiConnection

        images = self.client.get_images()

        print("Case 1: Download an existing layer, should succeed")
        layer_file = self.client.get_layer(image_id=images[0],
                                           download_folder=self.tmpdir)
        self.assertTrue(os.path.exists(layer_file))
예제 #15
0
class TestApi(TestCase):

    def setUp(self):
        self.image = 'docker://ubuntu:latest'
        self.tmpdir = tempfile.mkdtemp()
        os.environ['SINGULARITY_ROOTFS'] = self.tmpdir
        os.mkdir('%s/.singularity.d' % self.tmpdir)
        from docker.api import DockerApiConnection
        self.client = DockerApiConnection(image=self.image)

        print("\n---START----------------------------------------")

    def tearDown(self):
        shutil.rmtree(self.tmpdir)

        print("---END------------------------------------------")

    def test_create_runscript(self):
        '''test_create_runscript should ensure that
        a runscript is generated with some command
        '''
        from docker.api import DockerApiConnection

        print('Testing creation of runscript')
        from docker.tasks import extract_runscript

        manifest = self.client.get_manifest(old_version=True)

        print("Case 1: Asking for CMD when none defined")
        default_cmd = 'exec "/bin/bash"'
        runscript = extract_runscript(manifest=manifest,
                                      includecmd=True)
        self.assertTrue(default_cmd in runscript)

        print("Case 2: Asking for ENTRYPOINT when none defined")
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(default_cmd in runscript)

        client = DockerApiConnection(image="docker://bids/mriqc:0.0.2")
        manifest = client.get_manifest(old_version=True)

        print("Case 3: Asking for ENTRYPOINT when defined")
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue('exec "/run_mriqc"' in runscript)

        print("Case 4: Asking for CMD when defined")
        runscript = extract_runscript(manifest=manifest,
                                      includecmd=True)
        self.assertTrue('exec "--help"' in runscript)

        print("Case 5: Asking for ENTRYPOINT when None, should return CMD")
        from docker.tasks import get_configs
        client = DockerApiConnection(image="tensorflow/tensorflow:1.0.0")
        manifest = client.get_manifest(old_version=True)

        configs = get_configs(manifest, ['Cmd', 'Entrypoint'])
        self.assertEqual(configs['Entrypoint'], None)
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(configs['Cmd'][0] in runscript)

    def test_get_config(self):
        '''test_get_config will obtain parameters
        from the DOcker configuration json
        '''
        from docker.api import DockerApiConnection
        from docker.tasks import get_config

        # Default should return entrypoint
        print("Case 1: Ask for default command (Entrypoint)")
        manifest = self.client.get_manifest(old_version=True)
        entrypoint = get_config(manifest=manifest)

        # Ubuntu latest should have None
        self.assertEqual(entrypoint, None)

        print("Case 2: Ask for custom command (Cmd)")
        entrypoint = get_config(manifest=manifest,
                                spec="Cmd")
        self.assertTrue('/bin/bash' in entrypoint)
예제 #16
0
class TestApi(TestCase):
    def setUp(self):
        self.image = 'docker://ubuntu:latest'
        self.tmpdir = tempfile.mkdtemp()
        os.environ['SINGULARITY_ROOTFS'] = self.tmpdir
        os.mkdir('%s/.singularity.d' % self.tmpdir)
        from docker.api import DockerApiConnection
        self.client = DockerApiConnection(image=self.image)

        print("\n---START----------------------------------------")

    def tearDown(self):
        shutil.rmtree(self.tmpdir)

        print("---END------------------------------------------")

    def test_create_runscript(self):
        '''test_create_runscript should ensure that
        a runscript is generated with some command
        '''
        from docker.api import DockerApiConnection

        print('Testing creation of runscript')
        from docker.tasks import extract_runscript

        manifest = self.client.get_manifest(old_version=True)

        print("Case 1: Asking for CMD when none defined")
        default_cmd = 'exec "/bin/bash"'
        runscript = extract_runscript(manifest=manifest, includecmd=True)
        self.assertTrue(default_cmd in runscript)

        print("Case 2: Asking for ENTRYPOINT when none defined")
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(default_cmd in runscript)

        client = DockerApiConnection(image="docker://bids/mriqc:0.0.2")
        manifest = client.get_manifest(old_version=True)

        print("Case 3: Asking for ENTRYPOINT when defined")
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue('exec "/run_mriqc"' in runscript)

        print("Case 4: Asking for CMD when defined")
        runscript = extract_runscript(manifest=manifest, includecmd=True)
        self.assertTrue('exec "--help"' in runscript)

        print("Case 5: Asking for ENTRYPOINT when None, should return CMD")
        from docker.tasks import get_configs
        client = DockerApiConnection(image="tensorflow/tensorflow:1.0.0")
        manifest = client.get_manifest(old_version=True)

        configs = get_configs(manifest, ['Cmd', 'Entrypoint'])
        self.assertEqual(configs['Entrypoint'], None)
        runscript = extract_runscript(manifest=manifest)
        self.assertTrue(configs['Cmd'][0] in runscript)

    def test_get_config(self):
        '''test_get_config will obtain parameters
        from the DOcker configuration json
        '''
        from docker.api import DockerApiConnection
        from docker.tasks import get_config

        # Default should return entrypoint
        print("Case 1: Ask for default command (Entrypoint)")
        manifest = self.client.get_manifest(old_version=True)
        entrypoint = get_config(manifest=manifest)

        # Ubuntu latest should have None
        self.assertEqual(entrypoint, None)

        print("Case 2: Ask for custom command (Cmd)")
        entrypoint = get_config(manifest=manifest, spec="Cmd")
        self.assertTrue('/bin/bash' in entrypoint)
예제 #17
0
class TestApi(TestCase):

    def setUp(self):
        self.image = 'docker://ubuntu:latest'
        self.tmpdir = tempfile.mkdtemp()
        os.environ['SINGULARITY_ROOTFS'] = self.tmpdir
        os.mkdir('%s/.singularity.d' %(self.tmpdir))
        from docker.api import DockerApiConnection
        self.client = DockerApiConnection(image=self.image)

        print("\n---START----------------------------------------")

    def tearDown(self):
        shutil.rmtree(self.tmpdir)

        print("---END------------------------------------------")



    def test_get_token(self):
        '''test_get_token will obtain a token from the Docker registry for a namepspace
        and repo. 
        '''
        from docker.api import DockerApiConnection
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow:1.0.0")        

        print("Case 1: Ask when we don't need token returns None")
        token = client.update_token()
        self.assertEqual(token,None)


    def test_get_manifest(self):
        '''test_get_manifest will obtain a library/repo manifest
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Obtain manifest for %s/%s" %(self.client.namespace,
                                                    self.client.repo_name))

        manifest = self.client.get_manifest()

        # Default tag should be latest
        self.assertTrue("fsLayers" in manifest or "layers" in manifest)

        # Giving a bad tag sould return error
        print("Case 3: Bad tag should print valid tags and exit")
        client = DockerApiConnection(image="ubuntu:mmm.avocado")        
        
        # Should work for custom registries
        print("Case 4: Obtain manifest from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")        
        manifest = client.get_manifest()
        self.assertTrue("fsLayers" in manifest or "layers" in manifest)


    def test_get_images(self):
        '''test_get_images will obtain a list of images
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Ask for images")
        images = self.client.get_images()
        self.assertTrue(isinstance(images,list))
        self.assertTrue(len(images)>1)

        print("Case 2: Ask for images from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")        
        images = client.get_images()
        self.assertTrue(isinstance(images,list))
        self.assertTrue(len(images)>1)


    def test_get_tags(self):
        '''test_get_tags will obtain a list of tags
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Ask for tags from standard %s/%s" %(self.client.namespace,
                                                           self.client.repo_name))
        tags = self.client.get_tags()
        self.assertTrue(isinstance(tags,list))
        self.assertTrue(len(tags)>1)
        [self.assertTrue(x in tags) for x in ['xenial','latest','trusty','yakkety']]

        print("Case 2: Ask for tags from custom registry")
        client = DockerApiConnection(image="gcr.io/tensorflow/tensorflow")        
        tags = client.get_tags()
        self.assertTrue(isinstance(tags,list))
        self.assertTrue(len(tags)>1)
        [self.assertTrue(x in tags) for x in ['latest','latest-gpu']]
  


    def test_get_layer(self):
        '''test_get_layer will download docker layers
        '''
        from docker.api import DockerApiConnection

        images = self.client.get_images()
        
        print("Case 1: Download an existing layer, should succeed")
        layer_file = self.client.get_layer(image_id=images[0], 
                                           download_folder = self.tmpdir)
        self.assertTrue(os.path.exists(layer_file))
예제 #18
0
class TestApi(TestCase):
    def setUp(self):
        self.image = 'docker://ubuntu:latest'
        self.tmpdir = tempfile.mkdtemp()
        os.environ['SINGULARITY_ROOTFS'] = self.tmpdir
        os.mkdir('%s/.singularity.d' % self.tmpdir)
        from docker.api import DockerApiConnection
        self.client = DockerApiConnection(image=self.image)

        print("\n---START----------------------------------------")

    def tearDown(self):
        shutil.rmtree(self.tmpdir)

        print("---END------------------------------------------")

    def test_get_token(self):
        '''test_get_token will obtain a token from
           the Docker registry for a namepspace
           and repo.
        '''
        from docker.api import DockerApiConnection
        docker_image = "gcr.io/tensorflow/tensorflow:1.0.0"
        client = DockerApiConnection(image=docker_image)

        print("Case 1: Ask when we don't need token returns None")
        token = client.update_token()
        self.assertEqual(token, None)

    def test_get_token_url(self):
        '''
        test_get_token_url tests token url generation from a bearer auth
        challenge
        '''
        realm = 'https://some-registry.io/auth'
        service = "some-service"
        scope = "some-scope"
        expires_in = 9000

        cases = (
            [("realm", realm), ("service", service), ("scope", scope)],
            [("service", service), ("scope", scope), ("realm", realm)],
            [("scope", scope), ("realm", realm)],
            [("realm", realm), ("service", service)],
            [("realm", realm)],
        )

        for case in cases:
            challenge = 'Bearer %s' % ','.join(
                ['%s="%s"' % (k, v) for k, v in case])

            target_params = [(k, v) for k, v in case if k != 'realm']
            target_params.append(('expires_in', expires_in))
            target_params.sort()

            target_url = "{realm}?{query}".format(
                realm=realm,
                query='&'.join(['%s=%s' % (k, v) for k, v in target_params]))

            token_url = self.client.get_token_url(challenge,
                                                  expires_in,
                                                  sort_query_params=True)

            self.assertEqual(token_url, target_url)

    def test_get_manifest(self):
        '''test_get_manifest will obtain a library/repo manifest
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Obtain manifest for %s" % self.client.repo_name)

        manifest = self.client.get_manifest(old_version=True)

        # Default tag should be latest
        self.assertTrue("fsLayers" in manifest)

        # Giving a bad tag sould return error
        print("Case 3: Bad tag should print valid tags and exit")
        client = DockerApiConnection(image="ubuntu:mmm.avocado")

    def test_get_images(self):
        '''test_get_images will obtain a list of images
        '''
        from docker.api import DockerApiConnection

        images = self.client.get_images()
        self.assertTrue(isinstance(images, list))
        self.assertTrue(len(images) > 1)

    def test_get_tags(self):
        '''test_get_tags will obtain a list of tags
        '''
        from docker.api import DockerApiConnection

        print("Case 1: Ask for tags from standard %s" % self.client.repo_name)
        tags = self.client.get_tags()
        self.assertTrue(isinstance(tags, list))
        self.assertTrue(len(tags) > 1)
        ubuntu_tags = ['xenial', 'latest', 'trusty', 'yakkety']
        [self.assertTrue(x in tags) for x in ubuntu_tags]

    def test_get_layer(self):
        '''test_get_layer will download docker layers
        '''
        from docker.api import DockerApiConnection

        images = self.client.get_images()

        print("Case 1: Download an existing layer, should succeed")
        layer_file = self.client.get_layer(image_id=images[0],
                                           download_folder=self.tmpdir)
        self.assertTrue(os.path.exists(layer_file))