示例#1
0
    def test_container_ci_log_line(self, m_is_container, m_subp, m_get, m_g):
        path = os.path.dirname(os.path.abspath(__file__))
        log_path = path + '/boot-test.log'
        path += '/dummy.log'
        self.set_up_dummy_file_ci(path, log_path)

        parser = get_parser()
        args = parser.parse_args(args=['boot', '-i', path, '-o', log_path])
        name_default = ''
        finish_code = analyze_boot(name_default, args)

        self.remove_dummy_file(path, log_path)
        self.assertEqual(CONTAINER_CODE, finish_code)
    def test_container_ci_log_line(self, m_is_container, m_subp, m_get, m_g):
        path = os.path.dirname(os.path.abspath(__file__))
        log_path = path + "/boot-test.log"
        path += "/dummy.log"
        self.set_up_dummy_file_ci(path, log_path)

        parser = get_parser()
        args = parser.parse_args(args=["boot", "-i", path, "-o", log_path])
        name_default = ""
        finish_code = analyze_boot(name_default, args)

        self.remove_dummy_file(path, log_path)
        self.assertEqual(CONTAINER_CODE, finish_code)
    def test_boot_invalid_distro(self, m_dist_check_timestamp):

        path = os.path.dirname(os.path.abspath(__file__))
        log_path = path + "/boot-test.log"
        path += "/dummy.log"
        self.set_up_dummy_file(path, log_path)

        parser = get_parser()
        args = parser.parse_args(args=["boot", "-i", path, "-o", log_path])
        name_default = ""
        analyze_boot(name_default, args)
        # now args have been tested, go into outfile and make sure error
        # message is in the outfile
        outfh = open(args.outfile, "r")
        data = outfh.read()
        err_string = ("Your Linux distro or container does not support this "
                      "functionality.\nYou must be running a Kernel "
                      "Telemetry supported distro.\nPlease check "
                      "https://cloudinit.readthedocs.io/en/latest/topics"
                      "/analyze.html for more information on supported "
                      "distros.\n")

        self.remove_dummy_file(path, log_path)
        self.assertEqual(err_string, data)
示例#4
0
    def test_boot_invalid_distro(self, m_dist_check_timestamp):

        path = os.path.dirname(os.path.abspath(__file__))
        log_path = path + '/boot-test.log'
        path += '/dummy.log'
        self.set_up_dummy_file(path, log_path)

        parser = get_parser()
        args = parser.parse_args(args=['boot', '-i', path, '-o', log_path])
        name_default = ''
        analyze_boot(name_default, args)
        # now args have been tested, go into outfile and make sure error
        # message is in the outfile
        outfh = open(args.outfile, 'r')
        data = outfh.read()
        err_string = 'Your Linux distro or container does not support this ' \
                     'functionality.\nYou must be running a Kernel ' \
                     'Telemetry supported distro.\nPlease check ' \
                     'https://cloudinit.readthedocs.io/en/latest/topics' \
                     '/analyze.html for more information on supported ' \
                     'distros.\n'

        self.remove_dummy_file(path, log_path)
        self.assertEqual(err_string, data)