Use test-org from env var (#7016)
This commit is contained in:
parent
15418b6789
commit
3ef2648f45
|
@ -1126,6 +1126,9 @@ func TestImportExportStack(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNestedConfig(t *testing.T) {
|
||||
if getTestOrg() != "pulumi-test" {
|
||||
return
|
||||
}
|
||||
ctx := context.Background()
|
||||
stackName := FullyQualifiedStackName(pulumiOrg, "nested_config", "dev")
|
||||
|
||||
|
|
|
@ -132,6 +132,9 @@ describe("LocalWorkspace", () => {
|
|||
await ws.removeStack(stackName);
|
||||
}));
|
||||
it(`nested_config`, asyncTest(async () => {
|
||||
if (getTestOrg() !== "pulumi-test") {
|
||||
return;
|
||||
}
|
||||
const stackName = fullyQualifiedStackName(getTestOrg(), "nested_config", "dev");
|
||||
const workDir = upath.joinSafe(__dirname, "data", "nested_config");
|
||||
const stack = await LocalWorkspace.createOrSelectStack({ stackName, workDir });
|
||||
|
|
|
@ -31,8 +31,8 @@ runtime_error_project = "runtime_error"
|
|||
|
||||
class TestErrors(unittest.TestCase):
|
||||
def test_inline_runtime_error_python(self):
|
||||
stack_name = stack_namer()
|
||||
project_name = "inline_runtime_error_python"
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = create_stack(stack_name, program=failing_program, project_name=project_name)
|
||||
inline_error_text = "python inline source runtime error"
|
||||
|
||||
|
@ -49,7 +49,7 @@ class TestErrors(unittest.TestCase):
|
|||
@pytest.mark.skipif(sys.platform == "win32", reason="skipping on windows")
|
||||
def test_runtime_errors(self):
|
||||
for lang in ["python", "go", "dotnet", "javascript", "typescript"]:
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(runtime_error_project)
|
||||
project_dir = test_path("errors", runtime_error_project, lang)
|
||||
|
||||
if lang in ["javascript", "typescript"]:
|
||||
|
@ -71,7 +71,7 @@ class TestErrors(unittest.TestCase):
|
|||
stack.workspace.remove_stack(stack_name)
|
||||
|
||||
def test_compilation_error_go(self):
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(compilation_error_project)
|
||||
project_dir = test_path("errors", compilation_error_project, "go")
|
||||
stack = create_stack(stack_name, work_dir=project_dir)
|
||||
|
||||
|
@ -82,7 +82,7 @@ class TestErrors(unittest.TestCase):
|
|||
stack.workspace.remove_stack(stack_name)
|
||||
|
||||
def test_compilation_error_dotnet(self):
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(compilation_error_project)
|
||||
project_dir = test_path("errors", compilation_error_project, "dotnet")
|
||||
stack = create_stack(stack_name, work_dir=project_dir)
|
||||
|
||||
|
@ -96,7 +96,7 @@ class TestErrors(unittest.TestCase):
|
|||
# Skipping for now.
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="skipping on windows")
|
||||
def test_compilation_error_typescript(self):
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(compilation_error_project)
|
||||
project_dir = test_path("errors", compilation_error_project, "typescript")
|
||||
subprocess.run(["npm", "install"], check=True, cwd=project_dir, capture_output=True)
|
||||
stack = create_stack(stack_name, work_dir=project_dir)
|
||||
|
|
|
@ -63,8 +63,16 @@ def test_path(*paths):
|
|||
return os.path.join(os.path.dirname(os.path.abspath(__file__)), *paths)
|
||||
|
||||
|
||||
def stack_namer():
|
||||
return f"int_test_{get_test_suffix()}"
|
||||
def get_test_org():
|
||||
test_org = "pulumi-test"
|
||||
env_var = os.getenv("PULUMI_TEST_ORG")
|
||||
if env_var is not None:
|
||||
test_org = env_var
|
||||
return test_org
|
||||
|
||||
|
||||
def stack_namer(project_name):
|
||||
return fully_qualified_stack_name(get_test_org(), project_name, f"int_test_{get_test_suffix()}")
|
||||
|
||||
|
||||
def normalize_config_key(key: str, project_name: str):
|
||||
|
@ -201,9 +209,10 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
self.assertIsNotNone(result.user)
|
||||
|
||||
def test_stack_init(self):
|
||||
project_settings = ProjectSettings(name="python_test", runtime="python")
|
||||
project_name = "python_test"
|
||||
project_settings = ProjectSettings(name=project_name, runtime="python")
|
||||
ws = LocalWorkspace(project_settings=project_settings)
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(project_name)
|
||||
|
||||
Stack.create(stack_name, ws)
|
||||
# Trying to create the stack again throws an error
|
||||
|
@ -218,7 +227,7 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
project_name = "python_test"
|
||||
project_settings = ProjectSettings(project_name, runtime="python")
|
||||
ws = LocalWorkspace(project_settings=project_settings)
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = Stack.create(stack_name, ws)
|
||||
|
||||
config: ConfigMap = {
|
||||
|
@ -255,7 +264,7 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
project_name = "python_test"
|
||||
project_settings = ProjectSettings(project_name, runtime="python")
|
||||
ws = LocalWorkspace(project_settings=project_settings)
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = Stack.create(stack_name, ws)
|
||||
|
||||
config: ConfigMap = {
|
||||
|
@ -276,6 +285,8 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
ws.remove_stack(stack_name)
|
||||
|
||||
def test_nested_config(self):
|
||||
if get_test_org() != "pulumi-test":
|
||||
return
|
||||
stack_name = fully_qualified_stack_name("pulumi-test", "nested_config", "dev")
|
||||
project_dir = test_path("data", "nested_config")
|
||||
stack = create_or_select_stack(stack_name, work_dir=project_dir)
|
||||
|
@ -298,9 +309,10 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
self.assertEqual(arr.value, "[\"one\",\"two\",\"three\"]")
|
||||
|
||||
def test_stack_status_methods(self):
|
||||
project_settings = ProjectSettings(name="python_test", runtime="python")
|
||||
project_name = "python_test"
|
||||
project_settings = ProjectSettings(name=project_name, runtime="python")
|
||||
ws = LocalWorkspace(project_settings=project_settings)
|
||||
stack_name = stack_namer()
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = Stack.create(stack_name, ws)
|
||||
|
||||
history = stack.history()
|
||||
|
@ -311,8 +323,9 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
ws.remove_stack(stack_name)
|
||||
|
||||
def test_stack_lifecycle_local_program(self):
|
||||
stack_name = stack_namer()
|
||||
work_dir = test_path("data", "testproj")
|
||||
project_name = "testproj"
|
||||
stack_name = stack_namer(project_name)
|
||||
work_dir = test_path("data", project_name)
|
||||
stack = create_stack(stack_name, work_dir=work_dir)
|
||||
|
||||
config: ConfigMap = {
|
||||
|
@ -350,8 +363,8 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
stack.workspace.remove_stack(stack_name)
|
||||
|
||||
def test_stack_lifecycle_inline_program(self):
|
||||
stack_name = stack_namer()
|
||||
project_name = "inline_python"
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = create_stack(stack_name, program=pulumi_program, project_name=project_name)
|
||||
|
||||
stack_config: ConfigMap = {
|
||||
|
@ -391,8 +404,8 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
stack.workspace.remove_stack(stack_name)
|
||||
|
||||
def test_supports_stack_outputs(self):
|
||||
stack_name = stack_namer()
|
||||
project_name = "inline_python"
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = create_stack(stack_name, program=pulumi_program, project_name=project_name)
|
||||
|
||||
stack_config: ConfigMap = {
|
||||
|
@ -457,20 +470,19 @@ class TestLocalWorkspace(unittest.TestCase):
|
|||
self.assertIsNone(_validate_pulumi_version(test_min_version, current_version, opt_out))
|
||||
|
||||
def test_project_settings_respected(self):
|
||||
stack_name = stack_namer()
|
||||
project_name = "project_was_overwritten"
|
||||
project_name = "correct_project"
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = create_stack(stack_name,
|
||||
program=pulumi_program,
|
||||
project_name=project_name,
|
||||
opts=LocalWorkspaceOptions(work_dir=test_path("data", "correct_project")))
|
||||
opts=LocalWorkspaceOptions(work_dir=test_path("data", project_name)))
|
||||
project_settings = stack.workspace.project_settings()
|
||||
self.assertEqual(project_settings.name, "correct_project")
|
||||
self.assertEqual(project_settings.description, "This is a description")
|
||||
stack.workspace.remove_stack(stack_name)
|
||||
|
||||
def test_structured_events(self):
|
||||
stack_name = stack_namer()
|
||||
project_name = "structured_events"
|
||||
stack_name = stack_namer(project_name)
|
||||
stack = create_stack(stack_name, program=pulumi_program, project_name=project_name)
|
||||
|
||||
stack_config: ConfigMap = {
|
||||
|
|
Loading…
Reference in a new issue