1234567891011121314151617181920212223242526272829303132333435363738 |
- # -*- coding: utf-8 -*-
- """
- Integration tests for the lxd states
- """
- from __future__ import absolute_import, print_function, unicode_literals
- import pytest
- import salt.utils.path
- from tests.support.case import ModuleCase
- from tests.support.mixins import SaltReturnAssertsMixin
- from tests.support.unit import skipIf
- try:
- import pylxd # pylint: disable=import-error,unused-import
- HAS_PYLXD = True
- except ImportError:
- HAS_PYLXD = False
- @pytest.mark.destructive_test
- @skipIf(not salt.utils.path.which("lxd"), "LXD not installed")
- @skipIf(not salt.utils.path.which("lxc"), "LXC not installed")
- @skipIf(not HAS_PYLXD, "pylxd not installed")
- class LxdTestCase(ModuleCase, SaltReturnAssertsMixin):
- run_once = False
- @pytest.mark.flaky(max_runs=4)
- def test_01__init_lxd(self):
- if LxdTestCase.run_once:
- return
- ret = self.run_state("lxd.init", name="foobar")
- self.assertSaltTrueReturn(ret)
- LxdTestCase.run_once = True
- name = "lxd_|-foobar_|-foobar_|-init"
- assert name in ret
- assert ret[name]["storage_backend"] == "dir"
|