Skip to content

Commit

Permalink
Merge pull request #937 from openshift-cherrypick-robot/cherry-pick-8…
Browse files Browse the repository at this point in the history
…96-to-release-4.10

[release-4.10] WINC-607: Add support for platform=none in e2e test suite (Cont.)
  • Loading branch information
openshift-merge-robot committed Mar 3, 2022
2 parents f509f28 + 541ec41 commit 3a3ec53
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
3 changes: 3 additions & 0 deletions build/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ ENV OPERATOR=/usr/local/bin/windows-machine-config-operator \

# Changes needed for our CI

# jq is needed in e2e test script to count the number of data items in the windows-instances ConfigMap
RUN yum install -y jq

# Install client binaries
COPY --from=build /build/oc /usr/bin/oc
COPY --from=build /build/kubectl /usr/bin/kubectl
Expand Down
29 changes: 15 additions & 14 deletions test/e2e/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ func testWindowsNodeDeletion(t *testing.T) {
testCtx, err := NewTestContext()
require.NoError(t, err)

// set expected node count to zero, since all Windows Nodes should be deleted in the test
expectedNodeCount := int32(0)
// Get all the Machines created by the e2e tests
// For platform=none, the resulting slice is empty
e2eMachineSets, err := testCtx.client.Machine.MachineSets(clusterinfo.MachineAPINamespace).List(context.TODO(),
meta.ListOptions{LabelSelector: clusterinfo.MachineE2ELabel + "=true"})
require.NoError(t, err, "error listing MachineSets")
Expand All @@ -126,20 +129,18 @@ func testWindowsNodeDeletion(t *testing.T) {
break
}
}

require.NotNil(t, windowsMachineSetWithLabel, "could not find MachineSet with Windows label")

// Scale the Windows MachineSet to 0
expectedNodeCount := int32(0)
windowsMachineSetWithLabel.Spec.Replicas = &expectedNodeCount
_, err = testCtx.client.Machine.MachineSets(clusterinfo.MachineAPINamespace).Update(context.TODO(),
windowsMachineSetWithLabel, meta.UpdateOptions{})
require.NoError(t, err, "error updating Windows MachineSet")

// we are waiting 10 minutes for all windows machines to get deleted.
err = testCtx.waitForWindowsNodes(expectedNodeCount, true, false, false)
require.NoError(t, err, "Windows node deletion failed")

// skip the scale down step if there is no MachineSet with Windows label
if windowsMachineSetWithLabel != nil {
// Scale the Windows MachineSet to 0
windowsMachineSetWithLabel.Spec.Replicas = &expectedNodeCount
_, err = testCtx.client.Machine.MachineSets(clusterinfo.MachineAPINamespace).Update(context.TODO(),
windowsMachineSetWithLabel, meta.UpdateOptions{})
require.NoError(t, err, "error updating Windows MachineSet")

// we are waiting 10 minutes for all windows machines to get deleted.
err = testCtx.waitForWindowsNodes(expectedNodeCount, true, false, false)
require.NoError(t, err, "Windows node deletion failed")
}
t.Run("BYOH node removal", testCtx.testBYOHRemoval)

// Cleanup all the MachineSets created by us.
Expand Down
20 changes: 9 additions & 11 deletions test/e2e/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"

"github.com/openshift/windows-machine-config-operator/test/e2e/providers/vsphere"
)

// testNetwork runs all the cluster and node network tests
Expand Down Expand Up @@ -233,6 +231,12 @@ func testNorthSouthNetworking(t *testing.T) {
testCtx, err := NewTestContext()
require.NoError(t, err)

// Ignore the application ingress load balancer test for None and vSphere platforms as it has to be created manually
// https://docs.openshift.com/container-platform/4.9/networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-load-balancer.html
if testCtx.CloudProvider.GetType() == config.VSpherePlatformType ||
testCtx.CloudProvider.GetType() == config.NonePlatformType {
t.Skipf("NorthSouthNetworking test is disabled for platform %s", testCtx.CloudProvider.GetType())
}
// Require at least one node to test
require.NotEmpty(t, gc.allNodes())

Expand All @@ -248,15 +252,9 @@ func testNorthSouthNetworking(t *testing.T) {
require.NoError(t, err, "could not create Windows Server deployment")
defer testCtx.deleteDeployment(winServerDeployment.GetName())
testCtx.collectDeploymentLogs(winServerDeployment)

// Ignore the LoadBalancer test for vSphere as it has to be created manually
// https://docs.openshift.com/container-platform/4.5/networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-load-balancer.html#nw-using-load-balancer-getting-traffic_configuring-ingress-cluster-traffic-load-balancer
_, ok := testCtx.CloudProvider.(*vsphere.Provider)
if !ok {
// Assert that we can successfully GET the webserver
err = testCtx.getThroughLoadBalancer(winServerDeployment)
assert.NoError(t, err, "unable to GET the webserver through a load balancer")
}
// Assert that we can successfully GET the webserver
err = testCtx.getThroughLoadBalancer(winServerDeployment)
assert.NoError(t, err, "unable to GET the webserver through a load balancer")
}

// getThroughLoadBalancer does a GET request to the given webserver through a load balancer service
Expand Down

0 comments on commit 3a3ec53

Please sign in to comment.