pulumi / pulumi/pulumi-java

PULUMI_CONFIG env variable is not used with PulumiTest

Open
#1,333 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/testing kind/bug
Dominant language
Java
Stars
85
Forks
26
Avg merge
11h 49m
Merged PRs (30d)
22

Description

What happened?

Trying to use a configuration JSON during testing via the environment variable at runtime - as is the case with the implementation in other languages.

Example

Given '{"project:the_environment": "devtest"}' stored in PULUMI_CONFIG

final var config = ctx.config();
final var environment = config.get("the_environment")

fails when testing via PulumiTest

Output of pulumi about
CLI
Version      3.108.1
Go Version   go1.22.0
Go Compiler  gc

Plugins
NAME        VERSION
aws         6.18.2
aws-native  0.95.0
java        unknown

Host
OS       darwin
Version  14.4
Arch     x86_64
Additional context

Instead of initialising an empty config in PulumiTestInternal

if (this.config == null) {
                this.config = new DeploymentImpl.Config(ImmutableMap.of(), ImmutableSet.of());
}

it should be possible and safe to do

if (this.config == null) {
                this.config = Config.parse();
}

instead.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PulumiTestInternal and Config.parse, focusing on how the default configuration is initialized when PulumiTest runs. Use the Java example with PULUMI_CONFIG as the regression case, and confirm that ctx.config().get("the_environment") reads the supplied value instead of an empty configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.