Skip to content

Redid test framework to bring up driver on instance and expose TCP socket with SSH Tunneling #71

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 4 commits into from
Jul 19, 2018

Conversation

davidz627
Copy link
Contributor

@davidz627 davidz627 commented Jul 17, 2018

This framework change should allow for better test result viewing as well as multi-zonal tests.
Necessary to write tests for: #13

Any refactoring advice is appreciated, I realize that the interfaces are not exactly "clean" but they work. I might leave it like this for now and refactor when I understand what the needs are more when more tests start getting written.

The single e2e test is also gutted right now but I will add the necessary parts back in in a follow-up PR, didn't want to bloat this one even more.

/assign @msau42 @saad-ali

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: davidz627

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 17, 2018
Copy link
Contributor

@msau42 msau42 left a comment

Choose a reason for hiding this comment

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

The .tar.gz should probably not be checked in

Makefile Outdated
@@ -23,7 +23,7 @@ all: gce-pd-driver
gce-pd-driver:
mkdir -p bin
go build -ldflags "-X main.vendorVersion=${STAGINGVERSION}" -o bin/gce-pd-csi-driver ./cmd/
go test -c sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/e2e -o bin/e2e.test
#go test -c sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/e2e -o bin/e2e.test
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the intent to uncomment this eventually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dont need this bin anymore, removed

@@ -111,6 +113,8 @@ func (s *nonBlockingGRPCServer) serve(endpoint string, ids csi.IdentityServer, c

glog.Infof("Listening for connections on address: %#v", listener.Addr())

server.Serve(listener)
if err := server.Serve(listener); err != nil {
glog.Warningf("Failed to serve: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

just a warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fatal

binPath := path.Join(goPath, "src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver")

// TODO make the driver but from the base dir
out, err := exec.Command("go", "build", "-ldflags", "-X main.vendorVersion=latest", "-o", binPath, "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/cmd").CombinedOutput()
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 invoke 'make' instead so that it will use the makefile rules instead of recopying them here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if !ok {
return fmt.Errorf("Could not find environment variable GOPATH")
}
binPath := path.Join(goPath, "src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/bin/gce-pd-csi-driver")
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 make these paths and "gce-pd" names configurable? (ie i want to use this too)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


const (
// workspaceDirPrefix is the string prefix used in the workspace directory name.
workspaceDirPrefix = "gce-pd-e2e-"
Copy link
Contributor

Choose a reason for hiding this comment

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

make this configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


glog.V(2).Infof("Starting driver on %q", i.name)
// When the process is killed the driver should close the TCP endpoint, then we want to download the logs
output, err := i.SSH(fmt.Sprintf("sh -c '/usr/bin/nohup %s/gce-pd-csi-driver --endpoint=%s --nodeid=%s > %s/prog.out 2> %s/prog.err < /dev/null &'", workspace, endpoint, instanceName, workspace, workspace))
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 make the driver command configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

runInProw = flag.Bool("run-in-prow", false, "If true, use a Boskos loaned project and special CI service accounts and ssh keys")
)

func TestE2E(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the intention that you will be able to run multiple test files in one run? If so, you may want to move this "once per process" setup into its own file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

// Create Driver Archive
archiveName := "e2e_gce_pd_test.tar.gz"
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 make this configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the configuration (?). I don't think the person running the test needs to worry about setting the name for the tarball that gets uploaded. In fact the argument could be made that this should just be not configurable at all and just called thepackage.tar.gz or something

@@ -0,0 +1,82 @@
/*
Copyright 2016 The Kubernetes Authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix copyright.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,82 @@
/*
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 flatten all these files down one directory? ie, get rid of the second binremote

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@davidz627 davidz627 force-pushed the feature/e2eOverTCP branch from 89e4fb2 to 6b630c4 Compare July 19, 2018 00:19
RunSpecs(t, "Google Compute Engine Persistent Disk Container Storage Interface Driver Tests")

}

var _ = BeforeSuite(func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

should the before/after suite also go in the common e2e?

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 don't think so. Because these before and after are specific to single zonal case. I envision another test file that has mutlizonal tests that will need its own separate setup and probably some refactoring :)

return instance, nil
}

func setupProwConfig() (project, serviceAccount string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are all of these util methods being used?

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 separate out utils into a separate e2e/util pkg? Then that would make it easy for me to import

limitations under the License.
*/

package e2e
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 file into a e2e/util pkg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if I would recommend importing these, the interfaces are going to change a whole bunch based on my needs. They're not full wrappers, you can see some of the calls are missing some parameters and substitute default ones. If a test ends up needing to supply those parameters at some point I will just change the interface as needed

@msau42
Copy link
Contributor

msau42 commented Jul 19, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 19, 2018
@k8s-ci-robot k8s-ci-robot merged commit 8d2bd1a into kubernetes-sigs:master Jul 19, 2018
@davidz627 davidz627 deleted the feature/e2eOverTCP branch July 19, 2018 18:49
@davidz627 davidz627 mentioned this pull request Jul 19, 2018
jsafrane pushed a commit to jsafrane/gcp-compute-persistent-disk-csi-driver that referenced this pull request Apr 16, 2025
…ncy-openshift-4.18-ose-gcp-pd-csi-driver

OCPBUGS-41071: Updating ose-gcp-pd-csi-driver-container image to be consistent with ART for 4.18
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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants