-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PIPE-4359 Update config compilation pipeline values to add parameters
Config compilation now accepts pipeline values and parameters in a single map with the expected prefixes. All standard values are now prefixed with `pipeline.`, and all parameters are prefixed with `pipeline.parameters.` as described in the Pipeline Values documentation. https://circleci.com/docs/pipeline-variables/
- Loading branch information
1 parent
6584b7b
commit d54e181
Showing
6 changed files
with
81 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package config | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"golang.org/x/exp/maps" | ||
) | ||
|
||
func TestLocalPipelineValues(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
parameters Parameters | ||
wantKeys []string | ||
}{ | ||
{ | ||
name: "standard values given nil parameters", | ||
parameters: nil, | ||
wantKeys: []string{ | ||
"pipeline.id", | ||
"pipeline.number", | ||
"pipeline.project.git_url", | ||
"pipeline.project.type", | ||
"pipeline.git.tag", | ||
"pipeline.git.branch", | ||
"pipeline.git.revision", | ||
"pipeline.git.base_revision", | ||
}, | ||
}, | ||
{ | ||
name: "standard and prefixed parameters given map of parameters", | ||
parameters: Parameters{"foo": "bar", "baz": "buzz"}, | ||
wantKeys: []string{ | ||
"pipeline.id", | ||
"pipeline.number", | ||
"pipeline.project.git_url", | ||
"pipeline.project.type", | ||
"pipeline.git.tag", | ||
"pipeline.git.branch", | ||
"pipeline.git.revision", | ||
"pipeline.git.base_revision", | ||
"pipeline.parameters.foo", | ||
"pipeline.parameters.baz", | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
assert.ElementsMatchf(t, tt.wantKeys, maps.Keys(LocalPipelineValues(tt.parameters)), "LocalPipelineValues(%v)", tt.parameters) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters