Skip to content

Commit

Permalink
fix: delete duplicate app config generator tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkYuan committed Mar 13, 2024
1 parent b564ea5 commit 641d57f
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions pkg/modules/generators/app_configurations_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,6 @@ import (
"kusionstack.io/kusion/pkg/apis/core/v1/workload"
)

func TestAppConfigurationGenerator_Generate(t *testing.T) {
appName, app := buildMockApp()
ws := buildMockWorkspace("")

g := &appConfigurationGenerator{
project: "fakeNs",
stack: "test",
appName: appName,
app: app,
ws: ws,
}

spec := &v1.Intent{
Resources: []v1.Resource{},
}

mockPlugin()
err := g.Generate(spec)
assert.NoError(t, err)
assert.NotEmpty(t, spec.Resources)

// namespace name assertion
for _, res := range spec.Resources {
if res.Type != v1.Kubernetes {
continue
}
actual := mapToUnstructured(res.Attributes)
if actual.GetKind() == "Namespace" {
assert.Equal(t, "fakeNs", actual.GetName(), "namespace name should be fakeNs")
} else {
ns := actual.GetNamespace()
if ns == "" {
// Manually get the namespace from the unstructured object.
if ns, err = getNamespace(actual); err != nil {
t.Fatal(err)
}
}
assert.Equal(t, "fakeNs", ns, "namespace name should be fakeNs")
}
}
}

type fakeModule struct{}

func (f *fakeModule) Generate(ctx context.Context, req *proto.GeneratorRequest) (*proto.GeneratorResponse, error) {
Expand Down

0 comments on commit 641d57f

Please sign in to comment.