Skip to content

Commit d3e6e42

Browse files
authored
Add component tests (#17)
* Fix tests * Extend secret ready wait time * Extend secret ready wait time * Fix cluster store resource
1 parent 8bf6df3 commit d3e6e42

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

test/component_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/stretchr/testify/assert"
1717

1818
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19+
corev1 "k8s.io/api/core/v1"
1920
"k8s.io/apimachinery/pkg/runtime/schema"
2021
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2122

@@ -73,6 +74,10 @@ func (s *ComponentSuite) TestBasic() {
7374
assert.NotNil(s.T(), metadata.Values)
7475
assert.Equal(s.T(), metadata.Version, "0.8.3")
7576

77+
// Deploy second time to create ClusterSecretStore resource
78+
options, _ = s.DeployAtmosComponent(s.T(), component, stack, &inputs)
79+
assert.NotNil(s.T(), options)
80+
7681
config, err := awsHelper.NewK8SClientConfig(cluster)
7782
assert.NoError(s.T(), err)
7883
assert.NotNil(s.T(), config)
@@ -121,8 +126,7 @@ func (s *ComponentSuite) TestBasic() {
121126
},
122127
}
123128

124-
125-
factory := dynamicinformer.NewDynamicSharedInformerFactory(dynamicClient, 0)
129+
factory := dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynamicClient, time.Minute, corev1.NamespaceAll, nil)
126130
informer := factory.ForResource(externalSecretGVR).Informer()
127131

128132
stopChannel := make(chan struct{})
@@ -136,6 +140,7 @@ func (s *ComponentSuite) TestBasic() {
136140
return
137141
}
138142

143+
// Ensure we are checking the status of the correct object
139144
conditions, found, err := unstructured.NestedSlice(externalSecret.Object, "status", "conditions")
140145

141146
if err != nil || !found {
@@ -171,6 +176,7 @@ func (s *ComponentSuite) TestBasic() {
171176
msg := "ExternalSecret is ready"
172177
fmt.Println(msg)
173178
case <-time.After(1 * time.Minute):
179+
defer close(stopChannel)
174180
msg := "ExternalSecret is not ready"
175181
assert.Fail(s.T(), msg)
176182
}

test/fixtures/stacks/orgs/default/test/tests.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@ import:
22
- orgs/default/test/_defaults
33
- catalog/vpc
44
- catalog/eks-cluster
5-
- catalog/dns-primary
6-
- catalog/dns-delegated
7-
- catalog/eks-alb-controller
85
- catalog/usecase/basic
96
- catalog/usecase/disabled

0 commit comments

Comments
 (0)