-
Notifications
You must be signed in to change notification settings - Fork 159
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
Redid test framework to bring up driver on instance and expose TCP socket with SSH Tunneling #71
Conversation
…cket with SSH Tunneling
[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 |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
pkg/gce-pd-csi-driver/server.go
Outdated
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fatal
test/binremote/binremote/archiver.go
Outdated
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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/binremote/binremote/archiver.go
Outdated
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") |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/binremote/binremote/instance.go
Outdated
|
||
const ( | ||
// workspaceDirPrefix is the string prefix used in the workspace directory name. | ||
workspaceDirPrefix = "gce-pd-e2e-" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this configurable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/binremote/binremote/runner.go
Outdated
|
||
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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/e2e/single_zone_e2e_test.go
Outdated
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/e2e/utils.go
Outdated
} | ||
|
||
// Create Driver Archive | ||
archiveName := "e2e_gce_pd_test.tar.gz" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
test/binremote/binremote/archiver.go
Outdated
@@ -0,0 +1,82 @@ | |||
/* | |||
Copyright 2016 The Kubernetes Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix copyright.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/binremote/binremote/archiver.go
Outdated
@@ -0,0 +1,82 @@ | |||
/* |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…cgcepd specific code into variables
89e4fb2
to
6b630c4
Compare
test/e2e/single_zone_e2e_test.go
Outdated
RunSpecs(t, "Google Compute Engine Persistent Disk Container Storage Interface Driver Tests") | ||
|
||
} | ||
|
||
var _ = BeforeSuite(func() { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 :)
test/e2e/utils.go
Outdated
return instance, nil | ||
} | ||
|
||
func setupProwConfig() (project, serviceAccount string) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
test/e2e/client_wrappers.go
Outdated
limitations under the License. | ||
*/ | ||
|
||
package e2e |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
/lgtm |
…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
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