Ejemplo n.º 1
0
    def test_ubuntu(self):
        result = detect_os("ubuntu:xenial")
        self.assertEqual(result[0], 'Ubuntu')
        self.assertEqual(result[1], '16.04')

        result = detect_os("ubuntu:bionic")
        self.assertEqual(result[0], 'Ubuntu')
        self.assertEqual(result[1], '18.04')
Ejemplo n.º 2
0
    def test_ubuntu(self):
        result = detect_os("ubuntu:xenial")
        self.assertEqual(result[0], 'Ubuntu')
        self.assertEqual(result[1], '16.04')

        result = detect_os("ubuntu:bionic")
        self.assertEqual(result[0], 'Ubuntu')
        self.assertEqual(result[1], '18.04')

        # Cover verbose codepath
        result = detect_os("ubuntu:bionic", output_callback=print)
        self.assertEqual(result[0], 'Ubuntu')
        self.assertEqual(result[1], '18.04')
Ejemplo n.º 3
0
 def precondition_environment(self, cli_args):
     detected_os = detect_os(cli_args['base_image'], print, nocache=cli_args.get('nocache', False))
     if detected_os is None:
         print("WARNING unable to detect os for base image '%s', maybe the base image does not exist" % cliargs['base_image'])
         sys.exit(1)
     dist, ver, codename = detected_os
     if codename not in self.SUPPORTED_CODENAMES:
         print("ERROR: Unsupported codename for base image: %s not in %s" % (codename, self.SUPPORTED_CODENAMES))
         sys.exit(1)
Ejemplo n.º 4
0
 def test_cannot_detect_os(self):
     # Test with output callback too get coverage of error reporting
     result = detect_os("scratch", output_callback=print)
     self.assertEqual(result, None)
Ejemplo n.º 5
0
 def test_does_not_exist(self):
     result = detect_os("osrf/ros:does_not_exist")
     self.assertEqual(result, None)
Ejemplo n.º 6
0
 def test_fedora(self):
     result = detect_os("fedora:29")
     self.assertEqual(result[0], 'Fedora')
     self.assertEqual(result[1], '29')