Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds tests for apply output and sample project
- Loading branch information
Showing
7 changed files
with
65 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package projectconfig_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/commitdev/zero/internal/config/projectconfig" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestApply(t *testing.T) { | ||
// @TODO is there a way to do this without relative paths? | ||
// execCMD will use the current folder as target... | ||
dir := "../../../tests/test_data/" | ||
projectName := "sample_project" | ||
projectContext := &projectconfig.ZeroProjectConfig{ | ||
Name: projectName, | ||
Modules: projectconfig.EKSGoReactSampleModules(), | ||
} | ||
applyEnvironments := []string{"staging", "production"} | ||
|
||
want := []string{ | ||
"make module zero-aws-eks-stack\n", | ||
"make module zero-deployable-backend\n", | ||
"make module zero-deployable-react-frontend\n", | ||
} | ||
|
||
t.Run("Should run apply and execute make on each folder module", func(t *testing.T) { | ||
got := projectconfig.Apply(dir, projectContext, applyEnvironments) | ||
assert.Equal(t, want, got) | ||
}) | ||
} |
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,2 @@ | ||
current_dir: | ||
@echo "make module" `pwd | xargs basename` |
2 changes: 2 additions & 0 deletions
2
tests/test_data/sample_project/zero-deployable-backend/Makefile
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,2 @@ | ||
current_dir: | ||
@echo "make module" `pwd | xargs basename` |
2 changes: 2 additions & 0 deletions
2
tests/test_data/sample_project/zero-deployable-react-frontend/Makefile
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,2 @@ | ||
current_dir: | ||
@echo "make module" `pwd | xargs basename` |