Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use subtest labels for cleanup #577

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions e2e/alertmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ route:
receiver: "foobar"
`
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{Name: operator.AlertmanagerPublicSecretName},
ObjectMeta: metav1.ObjectMeta{
Name: operator.AlertmanagerPublicSecretName,
Labels: tctx.getSubTestLabels(),
},
Data: map[string][]byte{
operator.AlertmanagerPublicSecretKey: []byte(alertmanagerConfig),
},
Expand All @@ -67,7 +70,10 @@ route:
},
}
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{Name: "my-secret-name"},
ObjectMeta: metav1.ObjectMeta{
Name: "my-secret-name",
Labels: tctx.getSubTestLabels(),
},
Data: map[string][]byte{
"my-secret-key": []byte(alertmanagerConfig),
},
Expand All @@ -80,15 +86,17 @@ func testCreateAlertmanagerSecrets(ctx context.Context, t *OperatorContext, cert
secrets := []*corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "alertmanager-authorization",
Name: "alertmanager-authorization",
Labels: t.getSubTestLabels(),
},
Data: map[string][]byte{
"token": []byte("auth-bearer-password"),
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "alertmanager-tls",
Name: "alertmanager-tls",
Labels: t.getSubTestLabels(),
},
Data: map[string][]byte{
"cert": cert,
Expand All @@ -108,7 +116,8 @@ func testAlertmanagerDeployed(spec *monitoringv1.ManagedAlertmanagerSpec) func(c
return func(ctx context.Context, t *OperatorContext) {
opCfg := &monitoringv1.OperatorConfig{
ObjectMeta: metav1.ObjectMeta{
Name: operator.NameOperatorConfig,
Name: operator.NameOperatorConfig,
Labels: t.getSubTestLabels(),
},
Collection: monitoringv1.CollectionSpec{
ExternalLabels: map[string]string{
Expand Down
10 changes: 6 additions & 4 deletions e2e/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ func testCollectorDeployed(ctx context.Context, t *OperatorContext) {
// Create initial OperatorConfig to trigger deployment of resources.
opCfg := &monitoringv1.OperatorConfig{
ObjectMeta: metav1.ObjectMeta{
Name: operator.NameOperatorConfig,
Name: operator.NameOperatorConfig,
Labels: t.getSubTestLabels(),
},
Collection: monitoringv1.CollectionSpec{
ExternalLabels: map[string]string{
Expand Down Expand Up @@ -165,7 +166,8 @@ func testCollectorSelfPodMonitoring(ctx context.Context, t *OperatorContext) {
// should show up in Cloud Monitoring shortly after.
podmon := &monitoringv1.PodMonitoring{
ObjectMeta: metav1.ObjectMeta{
Name: "collector-podmon",
Name: "collector-podmon",
Labels: t.getSubTestLabels(),
},
Spec: monitoringv1.PodMonitoringSpec{
Selector: metav1.LabelSelector{
Expand Down Expand Up @@ -232,8 +234,8 @@ func testCollectorSelfClusterPodMonitoring(ctx context.Context, t *OperatorConte
// should show up in Cloud Monitoring shortly after.
podmon := &monitoringv1.ClusterPodMonitoring{
ObjectMeta: metav1.ObjectMeta{
Name: "collector-cmon",
OwnerReferences: t.ownerReferences,
Name: "collector-cmon",
Labels: t.getSubTestLabels(),
},
Spec: monitoringv1.ClusterPodMonitoringSpec{
Selector: metav1.LabelSelector{
Expand Down
Loading