Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor templatize ev2 package #887

Merged
merged 3 commits into from
Nov 25, 2024
Merged

refactor templatize ev2 package #887

merged 3 commits into from
Nov 25, 2024

Conversation

geoberle
Copy link
Collaborator

@geoberle geoberle commented Nov 25, 2024

What this PR does

  • PrecompilePipelineForEV2 renamed to PrecompilePipelineFileForEV2
  • PrecompilePipelineForEV2 reintroduced but returns a parsed pipeline.Pipeline struct
  • export all config.Pipeline sub-structs
  • export NewEv2ConfigReplacements
  • refactor tests to use fixtures

Jira:
Link to demo recording:

Special notes for your reviewer

@geoberle geoberle changed the title refactor test for templatize ev2 package refactor templatize ev2 package Nov 25, 2024
tooling/templatize/pkg/config/config.go Show resolved Hide resolved
tooling/templatize/pkg/pipeline/common.go Show resolved Hide resolved
tooling/templatize/pkg/ev2/pipeline.go Show resolved Hide resolved
tooling/templatize/pkg/ev2/pipeline.go Show resolved Hide resolved
Copy link

Please rebase pull request.

@@ -231,3 +233,78 @@ func TestConvertToInterface(t *testing.T) {
assert.IsType(t, expected, map[string]any{})
assert.IsType(t, expected["key2"], map[string]any{})
}

func TestPreprocessContent(t *testing.T) {
fileContent, err := os.ReadFile("../../testdata/test.bicepparam")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider //go:embed for static test data, much faster.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll do some readup on go:embed. ty

Copy link
Contributor

@stevekuznetsov stevekuznetsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

* `PrecompilePipelineForEV2` renamed to `PrecompilePipelineFileForEV2`
* `PrecompilePipelineForEV2` reintroduced but returns a parsed `pipeline.Pipeline` struct
* refactoring for testability

Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
Co-authored-by: Steve Kuznetsov <stekuznetsov@microsoft.com>
Signed-off-by: Gerd Oberlechner <goberlec@redhat.com>
@geoberle geoberle merged commit ecb197b into main Nov 25, 2024
18 checks passed
@geoberle geoberle deleted the ev2-pipeline-tests branch November 25, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants