def test_get_env_from_k8s_resources(self): assert get_env_from_k8s_resources(secrets=[], config_maps=[]) == [] res1 = V1K8sResourceType(name="test", schema=V1K8sResourceSchema(name="test"), is_requested=True) res2 = V1K8sResourceType(name="test2", schema=V1K8sResourceSchema(name="test2"), is_requested=True) expected = get_env_from_secrets(secrets=[res1, res2]) assert (get_env_from_k8s_resources(secrets=[res1, res2], config_maps=[]) == expected) expected = get_env_from_secrets( secrets=[res1]) + get_env_from_config_maps(config_maps=[res2]) assert (get_env_from_k8s_resources(secrets=[res1], config_maps=[res2]) == expected) expected = get_env_from_config_maps(config_maps=[res1, res2]) assert (get_env_from_k8s_resources(secrets=[], config_maps=[res1, res2]) == expected)
def test_get_env_from_config_maps(self): # None assert get_env_from_config_maps(config_maps=None) == [] # ConfigMap with items config_map1 = V1K8sResourceType( name="test1", schema=V1K8sResourceSchema(name="test1", items=["item1", "item2"]), is_requested=True, ) # ConfigMap config_map2 = V1K8sResourceType( name="test2", schema=V1K8sResourceSchema(name="test_ref"), is_requested=True) assert get_env_from_config_maps( config_maps=[config_map1, config_map2]) == [ get_env_from_config_map(config_map2) ]