Пример #1
0
 def initialize(self):
     super(Base, self).initialize()
     self.init_utilities()
     self.init_substitutions()
     self.do_substitutions()
     if '--tmpfs' in self.sub_stuff['subarg']:
         # Minimum docker version 1.10 is required for --tmpfs
         DockerVersion().require_server("1.10")
Пример #2
0
 def postprocess(self):
     super(version, self).postprocess()
     # Raise exception on Go Panic or usage help message
     outputgood = OutputGood(self.stuff['cmdresult'])
     docker_version = DockerVersion(outputgood.stdout_strip)
     self.loginfo("docker version client: %s server %s",
                  docker_version.client, docker_version.server)
     self.verify_version(docker_version)
Пример #3
0
 def _test_id(self):
     img_id = self.config['test_id']
     # FIXME: remove this once docker < 1.10 is eradicated
     try:
         DockerVersion().require_client("1.10")
     except xceptions.DockerTestNAError:
         img_id = self.config['test_id_old']
     return img_id.strip()
    def postprocess(self):
        super(run_cgroup_parent_base, self).postprocess()

        cmdresult = self.sub_stuff["cmdresult"]
        expected_status = self.sub_stuff["expected_status"]
        OutputGood(cmdresult, ignore_error=(expected_status != 0),
                   skip=['nonprintables_check'])

        self.sub_stuff["cid"] = self._read_cid()
        path_exp = self.sub_stuff['expected_path'].format(**self.sub_stuff)
        stderr_exp = self.sub_stuff['expected_stderr'].format(**self.sub_stuff)

        # Check stderr first: that way if we're not expecting an error, but
        # get one, our user has a better chance of seeing something useful.
        # (Note: Running docker with -D (debug) produces lots of cruft:
        #    time="...." level=debug msg="unwanted stuff"
        # Strip them out.)
        stderr = "\n".join([line
                            for line in cmdresult.stderr.strip().split("\n")
                            if not line.startswith('time="')])
        if stderr_exp:
            re_stderr = re.compile(stderr_exp)
            if not re.match(re_stderr, stderr):
                raise DockerTestFail("expected '%s' not found in stderr ('%s')"
                                     % (stderr_exp, stderr))
        else:
            self.failif_ne(stderr, stderr_exp, "unexpected stderr")

        # If we're expecting stdout, it must contain multiple lines each
        # of the form:
        #    <num>:<cgroup controller>:<path>
        # ...where <path> must exactly match the one in our test setup.
        stdout = cmdresult.stdout.strip()
        if path_exp:
            re_cgroup = re.compile(r'^(\d+):([^:]*):(.*)')
            found_match = False
            for line in stdout.split("\n"):
                m = re.match(re_cgroup, line)
                if m is None:
                    raise DockerTestFail("cgroup line does not conform to"
                                         " '<n>:<controller>:<path>': '%s'"
                                         % line)
                # bz1385924: 'pids' fails in docker-1.10; not worth fixing.
                if m.group(2) == 'pids':
                    if DockerVersion().server.startswith("1.10"):
                        continue
                self.failif_ne(m.group(3), path_exp, "cgroup path for %s:%s"
                               % (m.group(1), m.group(2)))
                found_match = True

            # Must find at least one matching cgroup line
            if not found_match:
                raise DockerTestFail("No output from cgroups")
        else:
            self.failif_ne(stdout, '', "unexpected output on stdout")

        # Check exit code last: the stdout/stderr diagnostics are more helpful
        self.failif_ne(cmdresult.exit_status, expected_status, "exit status")
Пример #5
0
 def run_is_deprecated(self):
     ver_stdout = mustpass(DockerCmd(self, "version").execute()).stdout
     dv = DockerVersion(ver_stdout)
     client_version = LooseVersion(dv.client)
     dep_version = LooseVersion(self.commit_run_deprecated_version)
     if client_version < dep_version:
         return False
     else:
         return True
Пример #6
0
 def _setup(self, cg_parent):
     """
     Set up test parameters: the value of the --cgroup--parent option.
     String may include {rand1} and/or {rand2}; we replace those with
     two pseudorandom strings.
     """
     DockerVersion().require_client("1.10")
     self.sub_stuff['rand1'] = utils.generate_random_string(8)
     self.sub_stuff['rand2'] = utils.generate_random_string(8)
     self.sub_stuff['cgroup_parent'] = cg_parent.format(**self.sub_stuff)
Пример #7
0
 def postprocess(self):
     super(version, self).postprocess()
     # Raise exception on Go Panic or usage help message
     outputgood = OutputGood(self.stuff['cmdresult'])
     docker_version = DockerVersion(outputgood.stdout_strip)
     info = ("docker version client: %s server %s" %
             (docker_version.client, docker_version.server))
     self.loginfo("Found %s", info)
     with open(os.path.join(self.job.sysinfo.sysinfodir, 'docker_version'),
               'wb') as info_file:
         info_file.write("%s\n" % info)
     self.verify_version(docker_version)
Пример #8
0
    def initialize(self):
        super(double_tag_force, self).initialize()
        # Difference from parent is that we use --force, and should pass
        self.sub_stuff['force_tag'] = True
        self.expect_pass(True)

        # -f option removed in docker 1.12
        try:
            DockerVersion().require_server("1.12")
            self.expect_pass(False)
        except xceptions.DockerTestNAError:
            pass
Пример #9
0
 def initialize(self):
     super(double_tag, self).initialize()
     # Tag it for the first time. This should pass...
     self.sub_stuff['tmp_image_list'].add(self.sub_stuff["new_image_name"])
     mustpass(
         DockerCmd(self, 'tag',
                   self.complete_docker_command_line()).execute())
     # On docker 1.10, the second tag should pass. On < 1.10, fail.
     try:
         DockerVersion().require_server("1.10")
         self.expect_pass(True)
     except xceptions.DockerTestNAError:
         self.expect_pass(False)
Пример #10
0
 def run_once(self):
     """
     Determine the installed version of docker, and preserve it
     in a sysinfo file.
     """
     super(log_versions, self).run_once()
     cmdresult = mustpass(DockerCmd(self, "version").execute())
     docker_version = DockerVersion(cmdresult.stdout)
     info = ("docker version client: %s server %s" %
             (docker_version.client, docker_version.server))
     self.loginfo("Found %s", info)
     self.write_sysinfo('docker_version', info + "\n")
     for rpm in get_as_list(self.config.get('key_rpms', '')):
         self.write_sysinfo('key_rpms', self._rpmq(rpm))
Пример #11
0
 def initialize(self):
     super(run_tmpfs, self).initialize()
     # Minimum docker version 1.10 is required for --tmpfs
     DockerVersion().require_server("1.10")
Пример #12
0
 def skip_if_docker_1_10():
     if DockerVersion().server.startswith("1.10"):
         raise DockerTestNAError("rhbz#1330224 will not be fixed in 1.10")
Пример #13
0
 def initialize(self):
     super(create_signal, self).initialize()
     DockerVersion().require_client(self.non_zero_exit_version)
     self.sub_stuff['sigdkrcmd'] = None