def __init__( self, name: str, node_id: str, namespace_create: bool = True, namespace_name: str = None, ) -> None: self.name = name self.node_id = node_id if namespace_name is None: self.ns = utils.new_namespace(name) else: self.ns = namespace_name # Flag to designate whether pytest setup (not TestMeta.setup) failed. # If pytest setup failed for the case, we can skip teardown, as there # will be nothing on the cluster itself. self._pt_setup_failed = False # lazy load self._client = None self._namespace = None self.namespace_create = namespace_create self.rolebindings = [] self.clusterrolebindings = [] self.test_objects = ObjectManager()
def test_new_namespace(name, expected): """Test creating a new namespace for the given function name.""" # mock the return of time.time() so we know what it will return utils.time.time = lambda: 1536849367.0 actual = utils.new_namespace(name) assert actual == expected
def __init__(self, name, node_id): self.name = name self.node_id = node_id self.ns = utils.new_namespace(name) # lazy load self._client = None self._namespace = None self.rolebindings = [] self.clusterrolebindings = [] self.test_objects = ObjectManager()