diff --git a/pkg/cmd/build/util_test.go b/pkg/cmd/build/util_test.go index c302dc50..7a28f027 100644 --- a/pkg/cmd/build/util_test.go +++ b/pkg/cmd/build/util_test.go @@ -208,6 +208,14 @@ func TestBuildIntent(t *testing.T) { mockers: []*mockey.MockBuilder{ mockey.Mock(kcl.Run).Return(&kcl.CompileResult{Documents: []kclgo.KCLResult{apcMap}}, nil), mockey.Mock(workspace.GetWorkspaceByDefaultOperator).Return(ws, nil), + mockey.Mock((*builders.AppsConfigBuilder).Build).To(func( + o *builders.Options, project *v1.Project, + stack *v1.Stack, + ) (*v1.Intent, + error, + ) { + return intentModel3, nil + }), }, }, want: intentModel3, @@ -252,6 +260,12 @@ func TestBuildIntent(t *testing.T) { mockers: []*mockey.MockBuilder{ mockey.Mock(kcl.Run).Return(&kcl.CompileResult{Documents: []kclgo.KCLResult{apcMap}}, nil), mockey.Mock(workspace.GetWorkspaceByDefaultOperator).Return(ws, nil), + mockey.Mock((*builders.AppsConfigBuilder).Build).To(func( + o *builders.Options, project *v1.Project, + stack *v1.Stack, + ) (*v1.Intent, error) { + return intentModel3, nil + }), }, }, want: intentModel3, diff --git a/pkg/modules/generators/app_configurations_generator_test.go b/pkg/modules/generators/app_configurations_generator_test.go index 63750f4e..61264e59 100644 --- a/pkg/modules/generators/app_configurations_generator_test.go +++ b/pkg/modules/generators/app_configurations_generator_test.go @@ -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) { diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 1a1cb556..e142dead 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -84,28 +84,29 @@ func createSampleWorkspace() error { } ws := &v1.Workspace{ Name: "dev", - Modules: v1.ModuleConfigs{ - "database": { - Default: v1.GenericConfig{ - "type": "aws", - "version": "5.7", - "instanceType": "db.t3.micro", - }, - ModulePatcherConfigs: v1.ModulePatcherConfigs{ - "smallClass": { - GenericConfig: v1.GenericConfig{ - "instanceType": "db.t3.small", - }, - ProjectSelector: []string{"foo", "bar"}, - }, - }, - }, - "port": { - Default: v1.GenericConfig{ - "type": "aws", - }, - }, - }, + // comment out for now, as download modules from remote repo is not supported yet. + // Modules: v1.ModuleConfigs{ + // "database": { + // Default: v1.GenericConfig{ + // "type": "aws", + // "version": "5.7", + // "instanceType": "db.t3.micro", + // }, + // ModulePatcherConfigs: v1.ModulePatcherConfigs{ + // "smallClass": { + // GenericConfig: v1.GenericConfig{ + // "instanceType": "db.t3.small", + // }, + // ProjectSelector: []string{"foo", "bar"}, + // }, + // }, + // }, + // "port": { + // Default: v1.GenericConfig{ + // "type": "aws", + // }, + // }, + // }, } return wsOperator.CreateWorkspace(ws) }