Skip to content

Commit

Permalink
Migrate TestResolveVariableReferencesToBundleVariables to acceptance …
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
denik committed Jan 14, 2025
1 parent a5e09ab commit 6aec7c7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bundle:
name: TestResolveVariableReferencesToBundleVariables

workspace:
root_path: "${bundle.name}/${var.foo}"

variables:
foo:
value: "bar"
11 changes: 11 additions & 0 deletions acceptance/bundle/variables/resolve-vars-in-root-path/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"artifact_path": "example/bar/artifacts",
"current_user": {
"short_name": "$USERNAME",
"userName": "$USERNAME"
},
"file_path": "example/bar/files",
"resource_path": "example/bar/resources",
"root_path": "example/bar",
"state_path": "example/bar/state"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$CLI bundle validate -o json | jq .workspace
23 changes: 0 additions & 23 deletions bundle/config/mutator/resolve_variable_references_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,6 @@ import (
"github.com/stretchr/testify/require"
)

func TestResolveVariableReferencesToBundleVariables(t *testing.T) {
b := &bundle.Bundle{
Config: config.Root{
Bundle: config.Bundle{
Name: "example",
},
Workspace: config.Workspace{
RootPath: "${bundle.name}/${var.foo}",
},
Variables: map[string]*variable.Variable{
"foo": {
Value: "bar",
},
},
},
}

// Apply with a valid prefix. This should change the workspace root path.
diags := bundle.Apply(context.Background(), b, ResolveVariableReferences("bundle", "variables"))
require.NoError(t, diags.Error())
require.Equal(t, "example/bar", b.Config.Workspace.RootPath)
}

func TestResolveVariableReferencesForPrimitiveNonStringFields(t *testing.T) {
var diags diag.Diagnostics

Expand Down

0 comments on commit 6aec7c7

Please sign in to comment.