Skip to content

Add e2e CI tests for Windows #529

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

Merged
merged 1 commit into from
Jul 7, 2020

Conversation

jingxu97
Copy link
Contributor

@jingxu97 jingxu97 commented Jun 17, 2020

This PR adds e2e CI tests for Windows.

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 17, 2020
@k8s-ci-robot k8s-ci-robot requested review from msau42 and saad-ali June 17, 2020 22:39
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 17, 2020
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 17, 2020
@jingxu97 jingxu97 force-pushed the June/windowstest branch 3 times, most recently from 06e6d4e to b9689dd Compare June 22, 2020 18:31
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 22, 2020
@jingxu97
Copy link
Contributor Author

/retest

@jingxu97
Copy link
Contributor Author

/test pull-gcp-compute-persistent-disk-csi-driver-kubernetes-integration

@jingxu97
Copy link
Contributor Author

/retest

}
defer func() {
err = setEnvProject(string(oldProject))
if *platform != "windows" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we intend to have a prow CI job to run windows? Then we should use boskos to get a project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. this is prow config file. https://github.com/kubernetes/test-infra/pull/17980/files

  • /workspace/scenarios/kubernetes_e2e.py already set up the project and kubernetes for windows I think. So instead of getting boskos for a new project, just use the current project. This is how other Windows test works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here explaining this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@@ -352,6 +355,9 @@ func generateGCETestSkip(clusterVersion string) string {
if v.LessThan(apimachineryversion.MustParseSemantic("1.16.0")) {
skipString = skipString + "|volumeMode\\sshould\\snot\\smount\\s/\\smap\\sunused\\svolumes\\sin\\sa\\spod"
}
if platform == "windows" {
skipString = skipString + "|\\[Slow\\]|\\[LinuxOnly\\]|\\[Feature:.+\\][Ephemeral]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What slow, and feature tests don't work on windows? Also ephemeral can probably be removed, there shouldn't be any external storage tests tagged with ephemeral

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en, I forgot why I added slow. I will remove it.

@@ -352,6 +355,9 @@ func generateGCETestSkip(clusterVersion string) string {
if v.LessThan(apimachineryversion.MustParseSemantic("1.16.0")) {
skipString = skipString + "|volumeMode\\sshould\\snot\\smount\\s/\\smap\\sunused\\svolumes\\sin\\sa\\spod"
}
if platform == "windows" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this before or after the version checks instead of in the middle?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -0,0 +1,48 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this script used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at first, I was trying to use a simple script to deploy and run tests for windows cluster. But later I release it missed driver build part which is available in the run-integration-test go program. So this script is not really used. I can remove it or adjust it and make it available just for users

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to add it in, maybe put it in an "experimental" directory and add a comment at the top explaining what the script is used for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove it for now, and add it later if needed.

WORKDIR /code
ADD . /code/

RUN cd /code/ && GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') GCE_PD_CSI_STAGING_VERSION=dev make gce-pd-driver-windows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't there issues with building in a container?

Copy link
Contributor Author

@jingxu97 jingxu97 Jun 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, but here the RUN command is being run on a Linux image
FROM --platform=$BUILDPLATFORM golang:1.13.3 AS builder. So this RUN can work here

@@ -0,0 +1,20 @@
StorageClass:
FromName: false
FromFile: sc-windows.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storageclass, snapshotclass, and capabilities should be templated as they are generated by the test runner, like https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/blob/master/test/k8s-integration/config/test-config-template.in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated using template.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing the update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove it.

@@ -1,3 +1,10 @@
kind: Namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why none of our tests were failing without this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was created in the driver deployment script. It is configurable. But looking at the kustomization code. it was hardcoded to gce-pd-csi-driver as namespace. Then it seems like we should not make it configurable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @verult

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installation script also creates a secret in the namespace using the JSON key provided by the user, which doesn't have a retry loop, so if the namespace hasn't been created yet the deployment would be broken.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

WORKDIR /code
ADD . /code/

RUN cd /code/ && GOARCH=$(echo $TARGETPLATFORM | cut -f2 -d '/') GCE_PD_CSI_STAGING_VERSION=dev make gce-pd-driver-windows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should GCE_PD_CSI_STAGING_VERSION be hardcoded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@msau42
Copy link
Contributor

msau42 commented Jun 26, 2020

/assign @mattcary

@k8s-ci-robot
Copy link
Contributor

@msau42: GitHub didn't allow me to assign the following users: mattcary.

Note that only kubernetes-sigs members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @mattcary

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jingxu97 jingxu97 force-pushed the June/windowstest branch 3 times, most recently from 9401be4 to 569ad3c Compare June 30, 2020 17:45
@jingxu97
Copy link
Contributor Author

Updated PR. @msau42 @verult PTAL

@jingxu97
Copy link
Contributor Author

/retest

@@ -0,0 +1,20 @@
StorageClass:
FromName: false
FromFile: sc-windows.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not seeing the update?

fmt.Sprintf("GCE_PD_CSI_STAGING_VERSION=%s", stagingVersion),
fmt.Sprintf("GCE_PD_CSI_STAGING_IMAGE=%s", stagingImage))
} else {
cmd = exec.Command("make", "-C", pkgDir, "build-and-push-windows-container-1909",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to test ltsc2019?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking to test this first and will add for ltsc2019 after finish testing.

}
defer func() {
err = setEnvProject(string(oldProject))
if *platform != "windows" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here explaining this?

oldProject, err := exec.Command("gcloud", "config", "get-value", "project").CombinedOutput()
*stagingImage = fmt.Sprintf("gcr.io/%s/gcp-persistent-disk-csi-driver", strings.TrimSpace(string(oldProject)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staging image should only be overridden if doDriverBuild = true. Can we actually pull L173 out of the linux block so we set it in one place for both windows and linux?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

if v.LessThan(apimachineryversion.MustParseSemantic("1.17.0")) {
skipString = skipString + "|VolumeSnapshotDataSource"
}
if platform == "windows" {
skipString = skipString + "|\\[LinuxOnly\\]|\\[Feature:.+\\][Ephemeral]"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to skip Feature and Ephemeral? Skipping Feature means snapshot tests won't run on windows. Ephemeral I think is not run as part of the external storage test suite anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove Feature and Ephemeral. I think the reason windows tests in presubmit remove Feature is to reduce running time. But periodic tests will test it.

--platform=windows --local-k8s-dir=${LOCAL_K8S_DIR} --bringup-cluster=false --teardown-cluster=false --teardown-driver=true\
--run-in-prow=true --deploy-overlay-name=${overlay_name} --service-account-file=${E2E_GOOGLE_APPLICATION_CREDENTIALS} \
--do-driver-build=${do_driver_build} --gce-zone=${gce_zone}\
--storageclass-file=sc-windows.yaml --snapshotclass-file=pd-volumesnapshotclass.yaml --test-focus="External.Storage.*ntfs" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need focus on ntfs? Configuring the fstype in the driver config should run the ntfs tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it

@@ -33,6 +34,7 @@ var (
teardownCluster = flag.Bool("teardown-cluster", true, "teardown the cluster after the e2e test")
teardownDriver = flag.Bool("teardown-driver", true, "teardown the driver after the e2e test")
bringupCluster = flag.Bool("bringup-cluster", true, "build kubernetes and bringup a cluster")
platform = flag.String("platform", "linux", "platform that the tests will be run, either linux or windows")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some ensureFlag logic below that bringup-cluster and teardown-cluster are required to be false for windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added it

@@ -0,0 +1,48 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to add it in, maybe put it in an "experimental" directory and add a comment at the top explaining what the script is used for.

--run-in-prow=true --deploy-overlay-name=${overlay_name} --service-account-file=${E2E_GOOGLE_APPLICATION_CREDENTIALS} \
--do-driver-build=${do_driver_build} --gce-zone=${gce_zone}\
--storageclass-file=sc-windows.yaml --snapshotclass-file=pd-volumesnapshotclass.yaml --test-focus="External.Storage.*ntfs" \
--deployment-strategy=${deployment_strategy} --num-nodes=4 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we need 4 nodes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--num-nodes was a required parameter. Remove this if bringupCluster is false

#readonly gce_region=${GCE_CLUSTER_REGION:-}
readonly image_type=${IMAGE_TYPE:-cos}

export GCE_PD_VERBOSITY=9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the verbosity. Before we were debugging some test config errors and bumped it up to debug, but forgot to bump it back down.

Copy link
Contributor Author

@jingxu97 jingxu97 Jul 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it

@jingxu97 jingxu97 force-pushed the June/windowstest branch from 9b332c7 to 1c2dbc5 Compare July 1, 2020 22:58
@jingxu97
Copy link
Contributor Author

jingxu97 commented Jul 1, 2020

/retest

1 similar comment
@jingxu97
Copy link
Contributor Author

jingxu97 commented Jul 1, 2020

/retest

@jingxu97 jingxu97 force-pushed the June/windowstest branch from 1c2dbc5 to 3aa390a Compare July 2, 2020 00:41
@jingxu97
Copy link
Contributor Author

jingxu97 commented Jul 2, 2020

/retest

@jingxu97 jingxu97 force-pushed the June/windowstest branch from 3aa390a to 87b3b36 Compare July 2, 2020 02:19
@jingxu97
Copy link
Contributor Author

jingxu97 commented Jul 2, 2020

@msau42 comments were addressed. PTAL.

}

if *platform == "windows" && *inProw {
ensureFlag(bringupCluster, false, "bringupCluster is set to false if it is for prow test in windows cluster")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually bringupCluster is not supported for any windows testing right? (even outside of prow)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now yes. Later we could add an option to bring up windows cluster.
Remove the inPros check.

--platform=windows --local-k8s-dir=${LOCAL_K8S_DIR} --bringup-cluster=false --teardown-cluster=false --teardown-driver=${teardown_driver}\
--run-in-prow=true --deploy-overlay-name=${overlay_name} --service-account-file=${E2E_GOOGLE_APPLICATION_CREDENTIALS} \
--do-driver-build=${do_driver_build} --gce-zone=${gce_zone}\
--storageclass-file=sc-windows.yaml --snapshotclass-file=pd-volumesnapshotclass.yaml --test-focus="External.Storage" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing sc-windows.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

readonly GCE_PD_DO_DRIVER_BUILD=false
readonly PKGDIR=${GOPATH}/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
readonly LOCAL_K8S_DIR=${GOPATH}/src/k8s.io/kubernetes
readonly overlay_name="${GCE_PD_OVERLAY_NAME:-alpha}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now the alpha overlay is pointing to an image in your own gcr gcr.io/jing-k8s-dev/gce-pd-windows-2019. Is that publicly accessible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

This PR adds e2e CI tests for Windows.
@jingxu97 jingxu97 force-pushed the June/windowstest branch from 87b3b36 to 33654c9 Compare July 7, 2020 00:03
@msau42
Copy link
Contributor

msau42 commented Jul 7, 2020

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jingxu97, msau42

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 7, 2020
@jingxu97
Copy link
Contributor Author

jingxu97 commented Jul 7, 2020

/retest

@k8s-ci-robot k8s-ci-robot merged commit 1c51cca into kubernetes-sigs:master Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants