Skip to content

Commit

Permalink
Fixing panic in go's ReadOpenEnvironment (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
IaroslavTitov authored Dec 4, 2024
1 parent fa8d853 commit 2c50a0f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions sdk/go/api_esc_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func (c *EscClient) ReadOpenEnvironment(ctx context.Context, org, projectName, e
return nil, nil, err
}

if env == nil || env.Properties == nil {
return nil, nil, nil
}

propertyMap := *env.Properties
for k, v := range propertyMap {
v.Value = mapValues(v.Value)
Expand Down
7 changes: 6 additions & 1 deletion sdk/go/api_esc_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions sdk/python/test/test_esc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def test_environment_end_to_end(self) -> None:
envs = self.client.list_environments(self.orgName)
self.assertFindEnv(envs)

_, _, yaml = self.client.open_and_read_environment(self.orgName, PROJECT_NAME, self.envName)
self.assertEqual(yaml, "{}\n")

fooReference = "${foo}"
yaml = f"""
imports:
Expand Down
4 changes: 4 additions & 0 deletions sdk/typescript/test/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ describe("ESC", async () => {
assert.notEqual(orgs, undefined);
assert(orgs?.environments?.some((e) => e.name === name));

let openEmptyEnv = await client.openAndReadEnvironment(PULUMI_ORG, PROJECT_NAME, name);
assert.deepEqual(openEmptyEnv?.environment, {})
assert.deepEqual(openEmptyEnv?.values, {})

const envDef: esc.EnvironmentDefinition = {
imports: [fullyQualifiedName(baseEnvName)],
values: {
Expand Down

0 comments on commit 2c50a0f

Please sign in to comment.