forked from openservicemesh/osm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e_fluentbit_deployment_test.go
74 lines (64 loc) · 2.22 KB
/
e2e_fluentbit_deployment_test.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package e2e
import (
"context"
"strings"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"github.com/openservicemesh/osm/pkg/constants"
. "github.com/openservicemesh/osm/tests/framework"
)
var _ = OSMDescribe("Test deployment of Fluent Bit sidecar",
OSMDescribeInfo{
Tier: 2,
Bucket: 2,
},
func() {
Context("Fluent Bit deployment", func() {
It("Deploys a Fluent Bit sidecar only when enabled", func() {
if Td.DeployOnOpenShift {
Skip("Skipping test: FluentBit not supported on OpenShift")
}
// Install OSM with Fluentbit
installOpts := Td.GetOSMInstallOpts()
installOpts.DeployFluentbit = true
Expect(Td.InstallOSM(installOpts)).To(Succeed())
pods, err := Td.Client.CoreV1().Pods(Td.OsmNamespace).List(context.TODO(), metav1.ListOptions{
LabelSelector: labels.SelectorFromSet(map[string]string{constants.AppLabel: constants.OSMControllerName}).String(),
})
Expect(err).NotTo(HaveOccurred())
cond := false
for _, pod := range pods.Items {
for _, container := range pod.Spec.Containers {
if strings.Contains(container.Image, "fluent-bit") {
cond = true
}
}
}
Expect(cond).To(BeTrue())
err = Td.DeleteNs(Td.OsmNamespace)
Expect(err).NotTo(HaveOccurred())
err = Td.WaitForNamespacesDeleted([]string{Td.OsmNamespace}, 60*time.Second)
Expect(err).NotTo(HaveOccurred())
// Install OSM without Fluentbit (default)
installOpts = Td.GetOSMInstallOpts()
Expect(Td.InstallOSM(installOpts)).To(Succeed())
Expect(Td.WaitForPodsRunningReady(Td.OsmNamespace, 60*time.Second, 2 /* controller, injector */, nil)).To(Succeed())
pods, err = Td.Client.CoreV1().Pods(Td.OsmNamespace).List(context.TODO(), metav1.ListOptions{
LabelSelector: labels.SelectorFromSet(map[string]string{constants.AppLabel: constants.OSMControllerName}).String(),
})
Expect(err).NotTo(HaveOccurred())
cond = false
for _, pod := range pods.Items {
for _, container := range pod.Spec.Containers {
if strings.Contains(container.Image, "fluent-bit") {
cond = true
}
}
}
Expect(cond).To(BeFalse())
})
})
})