Skip to content

Commit

Permalink
Merge pull request #1032 from shiftstack/e2e-error-logging
Browse files Browse the repository at this point in the history
✨E2E error logging improvements
  • Loading branch information
k8s-ci-robot authored Nov 2, 2021
2 parents 82bc42e + c12f58b commit 8fcb3e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ test: ## Run tests
# Can be run manually, e.g. via:
# export OPENSTACK_CLOUD_YAML_FILE="$(pwd)/clouds.yaml"
# E2E_GINKGO_ARGS="-stream -focus='default'" E2E_ARGS="-use-existing-cluster='true'" make test-e2e
E2E_GINKGO_ARGS ?= -stream
E2E_GINKGO_ARGS ?=
.PHONY: test-e2e ## Run e2e tests using clusterctl
test-e2e: $(GINKGO) $(KIND) $(KUSTOMIZE) e2e-image test-e2e-image-prerequisites ## Run e2e tests
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)
Expand Down
34 changes: 18 additions & 16 deletions test/e2e/suites/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,13 @@ var _ = Describe("e2e tests", func() {
})

Describe("Workload cluster (multiple attached networks)", func() {
var extraNet1, extraNet2 *networks.Network
var (
clusterName string
configCluster clusterctl.ConfigClusterInput
md []*clusterv1.MachineDeployment

extraNet1, extraNet2 *networks.Network
)

BeforeEach(func() {
var err error
Expand Down Expand Up @@ -225,17 +231,17 @@ var _ = Describe("e2e tests", func() {

os.Setenv("CLUSTER_EXTRA_NET_1", extraNet1.ID)
os.Setenv("CLUSTER_EXTRA_NET_2", extraNet2.ID)
})

It("should attach all machines to multiple networks", func() {
shared.Byf("Creating a cluster")
clusterName := fmt.Sprintf("cluster-%s", namespace.Name)
configCluster := defaultConfigCluster(clusterName, namespace.Name)
clusterName = fmt.Sprintf("cluster-%s", namespace.Name)
configCluster = defaultConfigCluster(clusterName, namespace.Name)
configCluster.ControlPlaneMachineCount = pointer.Int64Ptr(1)
configCluster.WorkerMachineCount = pointer.Int64Ptr(1)
configCluster.Flavor = shared.FlavorMultiNetwork
md := createCluster(ctx, configCluster)
md = createCluster(ctx, configCluster)
})

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

var seen []string
var seenNetworks []string
var seenAddresses clusterv1.MachineAddresses
for j := range ports {
port := &ports[j]

// Check that the port has an expected network ID
expectedDescription, ok := expectedPorts[port.NetworkID]
Expect(ok).To(BeTrue())

// Check that the port has the expected description for that network ID
Expect(port.Description).To(Equal(expectedDescription))
// Check that the port has an expected network ID and description
Expect(expectedPorts).To(HaveKeyWithValue(port.NetworkID, port.Description))

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

for k := range port.FixedIPs {
seenAddresses = append(seenAddresses, clusterv1.MachineAddress{
Expand Down

0 comments on commit 8fcb3e8

Please sign in to comment.