-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcreate_enable_force_delete.go
58 lines (44 loc) · 2.09 KB
/
create_enable_force_delete.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package e2e_test
import (
"context"
"time"
e2e "github.com/gardener/gardener/test/e2e/gardener"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"github.com/gardener/gardener-extension-shoot-rsyslog-relp/test/common"
)
var _ = Describe("Shoot Rsyslog Relp Extension Tests", func() {
f := defaultShootCreationFramework()
f.Shoot = e2e.DefaultShoot("e2e-rslog-fd")
common.AddOrUpdateRsyslogRelpExtension(f.Shoot)
It("Create Shoot with shoot-rsyslog-relp extension enabled and force delete Shoot", Label("force-delete"), func() {
ctx, cancel := context.WithTimeout(parentCtx, 20*time.Minute)
DeferCleanup(cancel)
By("Create Shoot")
Expect(f.CreateShootAndWaitForCreation(ctx, false)).To(Succeed())
f.Verify()
ctx, cancel = context.WithTimeout(parentCtx, 1*time.Minute)
DeferCleanup(cancel)
By("Create NetworkPolicy to allow traffic from Shoot nodes to the rsyslog-relp echo server")
Expect(createNetworkPolicyForEchoServer(ctx, f.ShootFramework.SeedClient, f.ShootFramework.ShootSeedNamespace())).To(Succeed())
By("Install rsyslog-relp unit on Shoot nodes")
common.ForEachNode(ctx, f.ShootFramework.ShootClient, func(ctx context.Context, node *corev1.Node) {
installRsyslogRelp(ctx, f.Logger, f.ShootFramework.ShootClient, node.Name)
})
By("Verify shoot-rsyslog-relp works")
ctx, cancel = context.WithTimeout(parentCtx, 5*time.Minute)
DeferCleanup(cancel)
verifier := common.NewVerifier(f.Logger, f.ShootFramework.ShootClient, f.ShootFramework.SeedClient, f.Shoot.Spec.Provider.Type, f.ShootFramework.Project.Name, f.Shoot.Name, string(f.Shoot.UID), false, "")
common.ForEachNode(ctx, f.ShootFramework.ShootClient, func(ctx context.Context, node *corev1.Node) {
verifier.VerifyExtensionForNode(ctx, node.Name)
})
By("Force Delete Shoot")
ctx, cancel = context.WithTimeout(parentCtx, 15*time.Minute)
DeferCleanup(cancel)
Expect(f.ForceDeleteShootAndWaitForDeletion(ctx, f.Shoot)).To(Succeed())
})
})