Skip to content

Commit f2ffcd9

Browse files
committed
Test
1 parent 01eaf74 commit f2ffcd9

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

internal/shared/util/testutils/artifacts.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
// CollectTestArtifacts gets all the artifacts from the test run and saves them to the artifact path.
2626
// Currently, it saves:
2727
// - clusterextensions
28+
// - clusterextensionrevisions
2829
// - pods logs
2930
// - deployments
3031
// - catalogsources
@@ -134,6 +135,23 @@ func CollectTestArtifacts(t *testing.T, artifactName string, c client.Client, cf
134135
}
135136
}
136137

138+
// Get secrets in all namespaces
139+
secrets := corev1.SecretList{}
140+
if err := c.List(context.Background(), &secrets, client.InNamespace(namespace.Name)); err != nil {
141+
fmt.Printf("Failed to list secrets %v in namespace: %q", err, namespace.Name)
142+
}
143+
for _, secret := range secrets.Items {
144+
// Save secret to artifact path
145+
secretYaml, err := yaml.Marshal(secret)
146+
if err != nil {
147+
fmt.Printf("Failed to marshal secret: %v", err)
148+
continue
149+
}
150+
if err := os.WriteFile(filepath.Join(namespacedArtifactPath, secret.Name+"-secret.yaml"), secretYaml, 0600); err != nil {
151+
fmt.Printf("Failed to write secret to file: %v", err)
152+
}
153+
}
154+
137155
// Get logs from all pods in all namespaces
138156
pods := corev1.PodList{}
139157
if err := c.List(context.Background(), &pods, client.InNamespace(namespace.Name)); err != nil {

0 commit comments

Comments
 (0)