squakez commented on code in PR #3279:
URL: https://github.com/apache/camel-k/pull/3279#discussion_r874925513


##########
pkg/trait/trait_types_test.go:
##########
@@ -45,89 +38,79 @@ func TestMultilinePropertiesHandled(t *testing.T) {
        assert.Equal(t, "prop = multi\\nline\n", 
cm.Data["application.properties"])
 }
 
-func createNominalDeploymentTraitTest() (*Environment, *appsv1.Deployment) {
-       deployment := &appsv1.Deployment{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: appsv1.DeploymentSpec{
-                       Template: corev1.PodTemplateSpec{},
-               },
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationValues(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-integration"},
+                                       {Type: "env", Value: 
"my-env-integration"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(deployment),
-       }
-
-       return environment, deployment
-}
-
-func createNominalMissingDeploymentTraitTest() *Environment {
-       environment := &Environment{
-               Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
+               IntegrationKit: &v1.IntegrationKit{
+                       Spec: v1.IntegrationKitSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: "my-cm-kit"},
+                                       {Type: "property", Value: "my-p-kit"},
+                               },
                        },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+               },
+               Platform: &v1.IntegrationPlatform{
+                       Spec: v1.IntegrationPlatformSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-platform"},
+                                       {Type: "secret", Value: 
"my-secret-platform"},
+                                       {Type: "property", Value: 
"my-p-platform"},
+                                       {Type: "env", Value: "my-env-platform"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(),
        }
+       e.Platform.ResyncStatusFullConfig()
 
-       return environment
+       assert.Contains(t, e.collectConfigurationValues("configmap"), 
"my-cm-integration")
+       assert.Contains(t, e.collectConfigurationValues("secret"), 
"my-secret-platform")
+       assert.Contains(t, e.collectConfigurationValues("property"), "my-p-kit")
+       assert.Contains(t, e.collectConfigurationValues("env"), 
"my-env-integration")
 }
 
-func createNominalKnativeServiceTraitTest() (*Environment, *serving.Service) {
-       knativeService := &serving.Service{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: serving.ServiceSpec{},
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationPairs(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{

Review Comment:
   Ditto



##########
pkg/trait/trait_types_test.go:
##########
@@ -45,89 +38,79 @@ func TestMultilinePropertiesHandled(t *testing.T) {
        assert.Equal(t, "prop = multi\\nline\n", 
cm.Data["application.properties"])
 }
 
-func createNominalDeploymentTraitTest() (*Environment, *appsv1.Deployment) {
-       deployment := &appsv1.Deployment{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: appsv1.DeploymentSpec{
-                       Template: corev1.PodTemplateSpec{},
-               },
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationValues(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-integration"},
+                                       {Type: "env", Value: 
"my-env-integration"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(deployment),
-       }
-
-       return environment, deployment
-}
-
-func createNominalMissingDeploymentTraitTest() *Environment {
-       environment := &Environment{
-               Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
+               IntegrationKit: &v1.IntegrationKit{
+                       Spec: v1.IntegrationKitSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: "my-cm-kit"},
+                                       {Type: "property", Value: "my-p-kit"},
+                               },
                        },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+               },
+               Platform: &v1.IntegrationPlatform{
+                       Spec: v1.IntegrationPlatformSpec{
+                               Configuration: []v1.ConfigurationSpec{

Review Comment:
   Not yet deprecated, but it will be soon. Let's try to use traits instead.



##########
pkg/trait/trait_types_test.go:
##########
@@ -45,89 +38,79 @@ func TestMultilinePropertiesHandled(t *testing.T) {
        assert.Equal(t, "prop = multi\\nline\n", 
cm.Data["application.properties"])
 }
 
-func createNominalDeploymentTraitTest() (*Environment, *appsv1.Deployment) {
-       deployment := &appsv1.Deployment{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: appsv1.DeploymentSpec{
-                       Template: corev1.PodTemplateSpec{},
-               },
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationValues(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-integration"},
+                                       {Type: "env", Value: 
"my-env-integration"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(deployment),
-       }
-
-       return environment, deployment
-}
-
-func createNominalMissingDeploymentTraitTest() *Environment {
-       environment := &Environment{
-               Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
+               IntegrationKit: &v1.IntegrationKit{
+                       Spec: v1.IntegrationKitSpec{
+                               Configuration: []v1.ConfigurationSpec{

Review Comment:
   Not yet deprecated, but it will be soon. Let's try to use traits instead.



##########
pkg/trait/trait_types_test.go:
##########
@@ -45,89 +38,79 @@ func TestMultilinePropertiesHandled(t *testing.T) {
        assert.Equal(t, "prop = multi\\nline\n", 
cm.Data["application.properties"])
 }
 
-func createNominalDeploymentTraitTest() (*Environment, *appsv1.Deployment) {
-       deployment := &appsv1.Deployment{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: appsv1.DeploymentSpec{
-                       Template: corev1.PodTemplateSpec{},
-               },
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationValues(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-integration"},
+                                       {Type: "env", Value: 
"my-env-integration"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(deployment),
-       }
-
-       return environment, deployment
-}
-
-func createNominalMissingDeploymentTraitTest() *Environment {
-       environment := &Environment{
-               Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
+               IntegrationKit: &v1.IntegrationKit{
+                       Spec: v1.IntegrationKitSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: "my-cm-kit"},
+                                       {Type: "property", Value: "my-p-kit"},
+                               },
                        },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+               },
+               Platform: &v1.IntegrationPlatform{
+                       Spec: v1.IntegrationPlatformSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-platform"},
+                                       {Type: "secret", Value: 
"my-secret-platform"},
+                                       {Type: "property", Value: 
"my-p-platform"},
+                                       {Type: "env", Value: "my-env-platform"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(),
        }
+       e.Platform.ResyncStatusFullConfig()
 
-       return environment
+       assert.Contains(t, e.collectConfigurationValues("configmap"), 
"my-cm-integration")
+       assert.Contains(t, e.collectConfigurationValues("secret"), 
"my-secret-platform")
+       assert.Contains(t, e.collectConfigurationValues("property"), "my-p-kit")
+       assert.Contains(t, e.collectConfigurationValues("env"), 
"my-env-integration")
 }
 
-func createNominalKnativeServiceTraitTest() (*Environment, *serving.Service) {
-       knativeService := &serving.Service{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: serving.ServiceSpec{},
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationPairs(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "property", Value: 
"p1=integration"},
+                                       {Type: "property", Value: 
"p4=integration"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(knativeService),
-       }
-
-       return environment, knativeService
-}
-
-func createNominalCronJobTraitTest() (*Environment, *v1beta1.CronJob) {
-       cronJob := &v1beta1.CronJob{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: v1beta1.CronJobSpec{},
-       }
-
-       environment := &Environment{
-               Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
+               IntegrationKit: &v1.IntegrationKit{
+                       Spec: v1.IntegrationKitSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "property", Value: "p1=kit"},
+                                       {Type: "property", Value: "p2=kit"},
+                               },
                        },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+               },
+               Platform: &v1.IntegrationPlatform{
+                       Spec: v1.IntegrationPlatformSpec{
+                               Configuration: []v1.ConfigurationSpec{

Review Comment:
   ditto



##########
pkg/trait/trait_types_test.go:
##########
@@ -45,89 +38,79 @@ func TestMultilinePropertiesHandled(t *testing.T) {
        assert.Equal(t, "prop = multi\\nline\n", 
cm.Data["application.properties"])
 }
 
-func createNominalDeploymentTraitTest() (*Environment, *appsv1.Deployment) {
-       deployment := &appsv1.Deployment{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: appsv1.DeploymentSpec{
-                       Template: corev1.PodTemplateSpec{},
-               },
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationValues(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-integration"},
+                                       {Type: "env", Value: 
"my-env-integration"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(deployment),
-       }
-
-       return environment, deployment
-}
-
-func createNominalMissingDeploymentTraitTest() *Environment {
-       environment := &Environment{
-               Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
+               IntegrationKit: &v1.IntegrationKit{
+                       Spec: v1.IntegrationKitSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: "my-cm-kit"},
+                                       {Type: "property", Value: "my-p-kit"},
+                               },
                        },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+               },
+               Platform: &v1.IntegrationPlatform{
+                       Spec: v1.IntegrationPlatformSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "configmap", Value: 
"my-cm-platform"},
+                                       {Type: "secret", Value: 
"my-secret-platform"},
+                                       {Type: "property", Value: 
"my-p-platform"},
+                                       {Type: "env", Value: "my-env-platform"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(),
        }
+       e.Platform.ResyncStatusFullConfig()
 
-       return environment
+       assert.Contains(t, e.collectConfigurationValues("configmap"), 
"my-cm-integration")
+       assert.Contains(t, e.collectConfigurationValues("secret"), 
"my-secret-platform")
+       assert.Contains(t, e.collectConfigurationValues("property"), "my-p-kit")
+       assert.Contains(t, e.collectConfigurationValues("env"), 
"my-env-integration")
 }
 
-func createNominalKnativeServiceTraitTest() (*Environment, *serving.Service) {
-       knativeService := &serving.Service{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: serving.ServiceSpec{},
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationPairs(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{
+                                       {Type: "property", Value: 
"p1=integration"},
+                                       {Type: "property", Value: 
"p4=integration"},
+                               },
                        },
                },
-               Resources: kubernetes.NewCollection(knativeService),
-       }
-
-       return environment, knativeService
-}
-
-func createNominalCronJobTraitTest() (*Environment, *v1beta1.CronJob) {
-       cronJob := &v1beta1.CronJob{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: v1beta1.CronJobSpec{},
-       }
-
-       environment := &Environment{
-               Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
+               IntegrationKit: &v1.IntegrationKit{
+                       Spec: v1.IntegrationKitSpec{
+                               Configuration: []v1.ConfigurationSpec{

Review Comment:
   ditto



##########
pkg/trait/trait_types_test.go:
##########
@@ -45,89 +38,79 @@ func TestMultilinePropertiesHandled(t *testing.T) {
        assert.Equal(t, "prop = multi\\nline\n", 
cm.Data["application.properties"])
 }
 
-func createNominalDeploymentTraitTest() (*Environment, *appsv1.Deployment) {
-       deployment := &appsv1.Deployment{
-               ObjectMeta: metav1.ObjectMeta{
-                       Name: "integration-name",
-               },
-               Spec: appsv1.DeploymentSpec{
-                       Template: corev1.PodTemplateSpec{},
-               },
-       }
-
-       environment := &Environment{
+func TestCollectConfigurationValues(t *testing.T) {
+       e := Environment{
                Integration: &v1.Integration{
-                       ObjectMeta: metav1.ObjectMeta{
-                               Name: "integration-name",
-                       },
-                       Status: v1.IntegrationStatus{
-                               Phase: v1.IntegrationPhaseDeploying,
+                       Spec: v1.IntegrationSpec{
+                               Configuration: []v1.ConfigurationSpec{

Review Comment:
   This is deprecated. We should use related traits instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to