Skip to content

Commit 9810f24

Browse files
committed
upkeep: removed two node suite from regular checks
updated tests to always target two node topology instead of being a suite tests small refactor and testing name change Signed-off-by: ehila <[email protected]>
1 parent c2d7f5b commit 9810f24

File tree

3 files changed

+36
-41
lines changed

3 files changed

+36
-41
lines changed

test/extended/two_node/tnf_topology.go

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ package two_node
33
import (
44
"context"
55
"fmt"
6+
"strings"
67

78
g "github.com/onsi/ginkgo/v2"
89
o "github.com/onsi/gomega"
910
v1 "github.com/openshift/api/config/v1"
1011
exutil "github.com/openshift/origin/test/extended/util"
11-
corev1 "k8s.io/api/core/v1"
1212
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1313
)
1414

1515
const ensurePodmanEtcdContainerIsRunning = "podman inspect --format '{{.State.Running}}' etcd"
1616

17-
var _ = g.Describe("[sig-node][apigroup:config.openshift.io][OCPFeatureGate:DualReplica][Suite:openshift/two-node] Two Node with Fencing topology", func() {
17+
var _ = g.Describe("[sig-node][apigroup:config.openshift.io][OCPFeatureGate:DualReplica] Two Node with Fencing topology", func() {
1818
defer g.GinkgoRecover()
1919
var (
2020
oc = exutil.NewCLIWithoutNamespace("")
@@ -24,13 +24,13 @@ var _ = g.Describe("[sig-node][apigroup:config.openshift.io][OCPFeatureGate:Dual
2424
skipIfNotTopology(oc, v1.DualReplicaTopologyMode)
2525
})
2626

27-
g.It("Should validate the number of control-planes, arbiters as configured", func() {
27+
g.It("should only have two control plane nodes and no arbiter nodes", func() {
2828
const (
2929
expectedControlPlanes = 2
3030
expectedArbiters = 0
3131
)
3232

33-
g.By(fmt.Sprintf("Ensuring only %d Control-plane nodes in the cluster, and %d Arbiter nodes", expectedControlPlanes, expectedArbiters))
33+
g.By(fmt.Sprintf("Ensuring only %d control-plane nodes in the cluster and no arbiter nodes", expectedControlPlanes))
3434
controlPlaneNodes, err := oc.AdminKubeClient().CoreV1().Nodes().List(context.Background(), metav1.ListOptions{
3535
LabelSelector: labelNodeRoleControlPlane,
3636
})
@@ -45,59 +45,56 @@ var _ = g.Describe("[sig-node][apigroup:config.openshift.io][OCPFeatureGate:Dual
4545
})
4646
})
4747

48-
var _ = g.Describe("[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica][Suite:openshift/two-node] Two Node with Fencing pods and podman containers", func() {
48+
var _ = g.Describe("[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica] Two Node with Fencing", func() {
4949
defer g.GinkgoRecover()
5050
var (
51-
oc = exutil.NewCLIWithoutNamespace("")
52-
nodes *corev1.NodeList
51+
oc = exutil.NewCLIWithoutNamespace("")
5352
)
5453

5554
g.BeforeEach(func() {
5655
skipIfNotTopology(oc, v1.DualReplicaTopologyMode)
57-
58-
var err error
59-
nodes, err = oc.AdminKubeClient().CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
60-
o.Expect(err).To(o.BeNil(), "Expected to retrieve all nodes without error")
6156
})
62-
g.It("Should validate the number of etcd pods and containers as configured", func() {
57+
g.It("should have etcd pods and containers configured correctly", func() {
6358
const (
6459
expectedEtcdPod = 2
6560
expectedEtcdCtlContainers = 2
6661
expectedEtcdContainers = 0
6762
)
6863

69-
nodeNameA := nodes.Items[0].Name
70-
nodeNameB := nodes.Items[1].Name
71-
7264
g.By("Ensuring 0 etcd pod containers and 2 etcdctl pod containers are running in the cluster ")
73-
pods, err := oc.AdminKubeClient().CoreV1().Pods("openshift-etcd").List(context.Background(), metav1.ListOptions{})
65+
pods, err := oc.AdminKubeClient().CoreV1().Pods("openshift-etcd").List(context.Background(), metav1.ListOptions{
66+
LabelSelector: "app=etcd",
67+
})
7468
o.Expect(err).To(o.BeNil(), "Expected to retrieve etcd pods in openshift-etcd namespace without error")
69+
o.Expect(pods.Items).To(o.HaveLen(expectedEtcdPod), "Expected to retrieve %d etcd pods in openshift-etcd namespace", expectedEtcdPod)
7570

76-
etcdPodCount := 0
7771
etcdContainerCount := 0
7872
etcdctlContainerCount := 0
73+
7974
for _, pod := range pods.Items {
80-
if pod.Name == "etcd-"+nodeNameA || pod.Name == "etcd-"+nodeNameB {
81-
etcdPodCount += 1
82-
for _, container := range pod.Spec.Containers {
83-
if container.Name == "etcd" {
84-
etcdContainerCount += 1
85-
}
86-
if container.Name == "etcdctl" {
87-
etcdctlContainerCount += 1
88-
}
75+
for _, container := range pod.Spec.Containers {
76+
if container.Name == "etcd" {
77+
etcdContainerCount += 1
78+
}
79+
if container.Name == "etcdctl" {
80+
etcdctlContainerCount += 1
8981
}
9082
}
9183
}
92-
o.Expect(etcdPodCount).To(o.Equal(expectedEtcdPod))
9384
o.Expect(etcdctlContainerCount).To(o.Equal(expectedEtcdCtlContainers))
9485
o.Expect(etcdContainerCount).To(o.Equal(expectedEtcdContainers))
9586
})
9687

97-
g.It("Should verify the number of podman-etcd containers as configured", func() {
88+
g.It("should have podman etcd containers running on each node", func() {
89+
nodes, err := oc.AdminKubeClient().CoreV1().Nodes().List(context.Background(), metav1.ListOptions{
90+
LabelSelector: labelNodeRoleControlPlane,
91+
})
92+
o.Expect(err).To(o.BeNil(), "Expected to retrieve control plane nodes without error")
93+
o.Expect(nodes.Items).To(o.HaveLen(2), "Expected to retrieve two control plane nodes for DualReplica topology")
94+
9895
g.By("Ensuring one podman etcd container is running on each node")
9996
for _, node := range nodes.Items {
100-
got, err := exutil.DebugNodeRetryWithOptionsAndChroot(oc, node.Name, "openshift-etcd", "podman", "inspect", "--format", "'{{.State.Running}}'", "etcd")
97+
got, err := exutil.DebugNodeRetryWithOptionsAndChroot(oc, node.Name, "openshift-etcd", strings.Split(ensurePodmanEtcdContainerIsRunning, " ")...)
10198
o.Expect(err).To(o.BeNil(), fmt.Sprintf("expected to call podman without errors on Node %s: error %v", node.Name, err))
10299
o.Expect(got).To(o.Equal("'true'"), fmt.Sprintf("expected a podman etcd container running on Node %s: got running %s", node.Name, got))
103100
}

test/extended/util/annotate/generated/zz_generated.annotations.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zz_generated.manifests/test-reporting.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,19 @@ spec:
184184
[Beta] [Feature:OffByDefault]'
185185
- featureGate: DualReplica
186186
tests:
187-
- testName: '[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica][Suite:openshift/two-node]
188-
Two Node with Fencing pods and podman containers Should validate the number
189-
of etcd pods and containers as configured'
190-
- testName: '[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica][Suite:openshift/two-node]
191-
Two Node with Fencing pods and podman containers Should verify the number
192-
of podman-etcd containers as configured'
187+
- testName: '[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica]
188+
Two Node with Fencing should have etcd pods and containers configured correctly'
189+
- testName: '[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica]
190+
Two Node with Fencing should have podman etcd containers running on each node'
193191
- testName: '[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica][Suite:openshift/two-node][Disruptive]
194192
Two Node with Fencing etcd recovery Should recover from graceful node shutdown
195193
with etcd member re-addition'
196194
- testName: '[sig-etcd][apigroup:config.openshift.io][OCPFeatureGate:DualReplica][Suite:openshift/two-node][Disruptive]
197195
Two Node with Fencing etcd recovery Should recover from ungraceful node shutdown
198196
with etcd member re-addition'
199-
- testName: '[sig-node][apigroup:config.openshift.io][OCPFeatureGate:DualReplica][Suite:openshift/two-node]
200-
Two Node with Fencing topology Should validate the number of control-planes,
201-
arbiters as configured'
197+
- testName: '[sig-node][apigroup:config.openshift.io][OCPFeatureGate:DualReplica]
198+
Two Node with Fencing topology should only have two control plane nodes and
199+
no arbiter nodes'
202200
- featureGate: DynamicResourceAllocation
203201
tests:
204202
- testName: '[sig-node] DRA [Feature:DynamicResourceAllocation] [FeatureGate:DynamicResourceAllocation]

0 commit comments

Comments
 (0)