Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.9] WINC-607: Add support for platform=none in e2e test suite (Cont.) #939

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,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 @@ -111,7 +111,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 @@ -122,20 +125,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