Beispiel #1
0
    def test_import(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(self.options, 'scanon/importtest', 'latest',
                                   cachedir=cache, expanddir=expand)
        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], 'home')
        self.assertTrue(os.path.islink(bfile))
Beispiel #2
0
    def test_chgtype(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(self.options, 'scanon/chgtype', 'latest',
                                   cachedir=cache, expanddir=expand)
        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], 'build/test')
        assert os.path.exists(bfile)
        bfile = os.path.join(resp['expandedpath'], 'build/test2')
        assert os.path.exists(bfile)
Beispiel #3
0
    def test_import(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(self.options,
                                   'scanon/importtest',
                                   'latest',
                                   cachedir=cache,
                                   expanddir=expand)
        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], 'home')
        self.assertTrue(os.path.islink(bfile))
Beispiel #4
0
    def test_unicode(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(self.options, 'scanon/unicode',
                                   'latest', cachedir=cache,
                                   expanddir=expand.encode('ascii'))

        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], u'\ua000')
        self.assertIn('workdir', resp)
        assert os.path.exists(resp['expandedpath'])
        assert os.path.exists(bfile)
Beispiel #5
0
    def test_whiteout(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)
        return
        resp = dockerv2.pull_image(self.options, 'dmjacobsen/whiteouttest',
                                   'latest', cachedir=cache, expanddir=expand)

        assert os.path.exists(resp['expandedpath'])
        assert os.path.exists(os.path.join(resp['expandedpath'], 'usr'))
        noexist = ['usr/local', 'usr/.wh.local']
        for loc in noexist:
            path = os.path.join(resp['expandedpath'], loc)
            assert not os.path.exists(path)
Beispiel #6
0
    def test_chgtype(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(self.options,
                                   'scanon/chgtype',
                                   'latest',
                                   cachedir=cache,
                                   expanddir=expand)
        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], 'build/test')
        assert os.path.exists(bfile)
        bfile = os.path.join(resp['expandedpath'], 'build/test2')
        assert os.path.exists(bfile)
Beispiel #7
0
    def test_unicode(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(self.options,
                                   'scanon/unicode',
                                   'latest',
                                   cachedir=cache,
                                   expanddir=expand.encode('ascii'))

        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], u'\ua000')
        assert os.path.exists(resp['expandedpath'])
        assert os.path.exists(bfile)
Beispiel #8
0
    def test_permission_fixes(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(None, 'scanon/shanetest', 'latest',
                                   cachedir=cache, expanddir=expand)

        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], 'tmp/b')
        assert os.path.exists(bfile)
        with open(bfile) as f:
            data = f.read()
            assert(data == 'blah\n')
        return
Beispiel #9
0
    def test_whiteout(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(None, 'dmjacobsen/whiteouttest', 'latest', \
                cachedir=cache, expanddir=expand)

        assert os.path.exists(resp['expandedpath'])
        assert os.path.exists(os.path.join(resp['expandedpath'], 'usr'))
        noexist = ['usr/local', 'usr/.wh.local']
        for loc in noexist:
            path = os.path.join(resp['expandedpath'], loc)
            assert not os.path.exists(path)

        return
Beispiel #10
0
    def test_permission_fixes(self):
        cache = tempfile.mkdtemp()
        expand = tempfile.mkdtemp()
        self.cleanpaths.append(cache)
        self.cleanpaths.append(expand)

        resp = dockerv2.pull_image(self.options,
                                   'scanon/shanetest',
                                   'latest',
                                   cachedir=cache,
                                   expanddir=expand)

        assert os.path.exists(resp['expandedpath'])
        bfile = os.path.join(resp['expandedpath'], 'tmp/b')
        assert os.path.exists(bfile)
        with open(bfile) as f:
            data = f.read()
            assert (data == 'blah\n')
        return