Skip to content

Commit 8fcb3e8

Browse files
authored
Merge pull request #1032 from shiftstack/e2e-error-logging
✨E2E error logging improvements
2 parents 82bc42e + c12f58b commit 8fcb3e8

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ test: ## Run tests
122122
# Can be run manually, e.g. via:
123123
# export OPENSTACK_CLOUD_YAML_FILE="$(pwd)/clouds.yaml"
124124
# E2E_GINKGO_ARGS="-stream -focus='default'" E2E_ARGS="-use-existing-cluster='true'" make test-e2e
125-
E2E_GINKGO_ARGS ?= -stream
125+
E2E_GINKGO_ARGS ?=
126126
.PHONY: test-e2e ## Run e2e tests using clusterctl
127127
test-e2e: $(GINKGO) $(KIND) $(KUSTOMIZE) e2e-image test-e2e-image-prerequisites ## Run e2e tests
128128
time $(GINKGO) --failFast -trace -progress -v -tags=e2e --nodes=$(E2E_GINKGO_PARALLEL) $(E2E_GINKGO_ARGS) ./test/e2e/suites/e2e/... -- -config-path="$(E2E_CONF_PATH)" -artifacts-folder="$(ARTIFACTS)" --data-folder="$(E2E_DATA_DIR)" $(E2E_ARGS)

test/e2e/suites/e2e/e2e_test.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ var _ = Describe("e2e tests", func() {
196196
})
197197

198198
Describe("Workload cluster (multiple attached networks)", func() {
199-
var extraNet1, extraNet2 *networks.Network
199+
var (
200+
clusterName string
201+
configCluster clusterctl.ConfigClusterInput
202+
md []*clusterv1.MachineDeployment
203+
204+
extraNet1, extraNet2 *networks.Network
205+
)
200206

201207
BeforeEach(func() {
202208
var err error
@@ -225,17 +231,17 @@ var _ = Describe("e2e tests", func() {
225231

226232
os.Setenv("CLUSTER_EXTRA_NET_1", extraNet1.ID)
227233
os.Setenv("CLUSTER_EXTRA_NET_2", extraNet2.ID)
228-
})
229234

230-
It("should attach all machines to multiple networks", func() {
231235
shared.Byf("Creating a cluster")
232-
clusterName := fmt.Sprintf("cluster-%s", namespace.Name)
233-
configCluster := defaultConfigCluster(clusterName, namespace.Name)
236+
clusterName = fmt.Sprintf("cluster-%s", namespace.Name)
237+
configCluster = defaultConfigCluster(clusterName, namespace.Name)
234238
configCluster.ControlPlaneMachineCount = pointer.Int64Ptr(1)
235239
configCluster.WorkerMachineCount = pointer.Int64Ptr(1)
236240
configCluster.Flavor = shared.FlavorMultiNetwork
237-
md := createCluster(ctx, configCluster)
241+
md = createCluster(ctx, configCluster)
242+
})
238243

244+
It("should attach all machines to multiple networks", func() {
239245
workerMachines := framework.GetMachinesByMachineDeployments(ctx, framework.GetMachinesByMachineDeploymentsInput{
240246
Lister: e2eCtx.Environment.BootstrapClusterProxy.GetClient(),
241247
ClusterName: clusterName,
@@ -276,21 +282,17 @@ var _ = Describe("e2e tests", func() {
276282
Expect(err).NotTo(HaveOccurred())
277283
Expect(ports).To(HaveLen(len(expectedPorts)))
278284

279-
var seen []string
285+
var seenNetworks []string
280286
var seenAddresses clusterv1.MachineAddresses
281287
for j := range ports {
282288
port := &ports[j]
283289

284-
// Check that the port has an expected network ID
285-
expectedDescription, ok := expectedPorts[port.NetworkID]
286-
Expect(ok).To(BeTrue())
287-
288-
// Check that the port has the expected description for that network ID
289-
Expect(port.Description).To(Equal(expectedDescription))
290+
// Check that the port has an expected network ID and description
291+
Expect(expectedPorts).To(HaveKeyWithValue(port.NetworkID, port.Description))
290292

291-
// Check that we don't have duplicate networks
292-
Expect(seen).ToNot(ContainElement(port.NetworkID))
293-
seen = append(seen, port.NetworkID)
293+
// We don't expect to see another port with this network on this machine
294+
Expect(seenNetworks).ToNot(ContainElement(port.NetworkID))
295+
seenNetworks = append(seenNetworks, port.NetworkID)
294296

295297
for k := range port.FixedIPs {
296298
seenAddresses = append(seenAddresses, clusterv1.MachineAddress{

0 commit comments

Comments
 (0)