Exemplo n.º 1
0
 def test_check_series_calls(self):
     client = MagicMock(spec=["get_juju_output"])
     with patch.object(client,
                       'get_juju_output',
                       return_value="Codename:	xenial") as gjo_mock:
         check_series(client, 2, 'xenial')
     gjo_mock.assert_called_once_with('ssh', 2, 'lsb_release', '-c')
def assess_multi_series_charms(client, devel_series):
    """Assess multi series charms.

    :param client: Juju client.
    :param devel_series: The series to use for new and unsupported scenarios.
    :type client: jujupy.ModelClient
    :return: None
    """
    tests = [
        Test(series=devel_series,
             service='test0',
             force=False,
             success=False,
             machine=None,
             juju1x_supported=False),
        Test(series=None,
             service='test1',
             force=False,
             success=True,
             machine='0',
             juju1x_supported=True),
        Test(series="trusty",
             service='test2',
             force=False,
             success=True,
             machine='1',
             juju1x_supported=True),
        Test(series="xenial",
             service='test3',
             force=False,
             success=True,
             machine='2',
             juju1x_supported=False),
        Test(series=devel_series,
             service='test4',
             force=True,
             success=True,
             machine='3',
             juju1x_supported=False),
    ]
    with temp_dir() as repository:
        charm_name = 'dummy'
        charm = Charm(charm_name, 'Test charm', series=['trusty', 'xenial'])
        charm_dir = charm.to_repo_dir(repository)
        charm_path = local_charm_path(charm=charm_name,
                                      juju_ver=client.version,
                                      series='trusty',
                                      repository=os.path.dirname(charm_dir))
        for test in tests:
            if client.is_juju1x() and not test.juju1x_supported:
                continue
            log.info(
                "Assessing multi series charms: test: {} charm_dir:{}".format(
                    test, charm_path))
            assert_deploy(client, test, charm_path, repository=repository)
            if test.machine:
                check_series(client, machine=test.machine, series=test.series)
Exemplo n.º 3
0
def assess_multi_series_charms(client, devel_series):
    """Assess multi series charms.

    :param client: Juju client.
    :param devel_series: The series to use for new and unsupported scenarios.
    :type client: jujupy.ModelClient
    :return: None
    """
    tests = [
        Test(series=devel_series, service='test0', force=False, success=False,
             machine=None, juju1x_supported=False),
        Test(series=None, service='test1', force=False, success=True,
             machine='0', juju1x_supported=True),
        Test(series="trusty", service='test2', force=False, success=True,
             machine='1', juju1x_supported=True),
        Test(series="xenial", service='test3', force=False, success=True,
             machine='2', juju1x_supported=False),
        Test(series=devel_series, service='test4', force=True, success=True,
             machine='3', juju1x_supported=False),
    ]
    with temp_dir() as repository:
        charm_name = 'dummy'
        charm = Charm(charm_name, 'Test charm', series=['trusty', 'xenial'])
        charm_dir = charm.to_repo_dir(repository)
        charm_path = local_charm_path(
            charm=charm_name, juju_ver=client.version, series='trusty',
            repository=os.path.dirname(charm_dir))
        for test in tests:
            if client.is_juju1x() and not test.juju1x_supported:
                continue
            log.info(
                "Assessing multi series charms: test: {} charm_dir:{}".format(
                    test, charm_path))
            assert_deploy(client, test, charm_path, repository=repository)
            if test.machine:
                check_series(client, machine=test.machine, series=test.series)
Exemplo n.º 4
0
 def test_check_series_exceptionl(self):
     client = fake_juju_client()
     client.bootstrap()
     with self.assertRaisesRegexp(
             AssertionError, 'Series is angsty, not xenial'):
         check_series(client, '0', 'xenial')
Exemplo n.º 5
0
 def test_check_series_calls(self):
     client = MagicMock(spec=["get_juju_output"])
     with patch.object(client, 'get_juju_output',
                       return_value="Codename:	xenial") as gjo_mock:
         check_series(client, 2, 'xenial')
     gjo_mock.assert_called_once_with('ssh', 2, 'lsb_release', '-c')
Exemplo n.º 6
0
 def test_check_series_xenial(self):
     client = MagicMock(spec=["get_juju_output"])
     client.get_juju_output.return_value = "Codename:	xenial"
     check_series(client, 1, 'xenial')
Exemplo n.º 7
0
 def test_check_series(self):
     client = fake_juju_client()
     client.bootstrap()
     check_series(client)
Exemplo n.º 8
0
 def test_check_series_exceptionl(self):
     client = fake_juju_client()
     client.bootstrap()
     with self.assertRaisesRegexp(AssertionError,
                                  'Series is angsty, not xenial'):
         check_series(client, '0', 'xenial')
Exemplo n.º 9
0
 def test_check_series_xenial(self):
     client = MagicMock(spec=["get_juju_output"])
     client.get_juju_output.return_value = "Codename:	xenial"
     check_series(client, 1, 'xenial')
Exemplo n.º 10
0
 def test_check_series(self):
     client = fake_juju_client()
     client.bootstrap()
     check_series(client)