Skip to content

Extend support for testing from locally built artifacts #95

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 10 commits into from
Feb 25, 2021

Conversation

amwat
Copy link
Contributor

@amwat amwat commented Feb 25, 2021

Add functionality to the ginkgo tester to be able to test from current builds.
somewhat makes it easier for #87

This will help solve skew problems e.g. kubectl https://testgrid.k8s.io/conformance-all#Conformance%20-%20GCE%20-%20master%20-%20kubetest2

Also refactor kind deployer a bit.

local testing is now as easy as :)

kubetest2 kind --build --up --test=ginkgo -- --focus-regex='Kubectl.client.Kubectl.replace.should.update.a.single-container'

xref: kubernetes/enhancements#2464

/cc @BenTheElder @spiffxp

@k8s-ci-robot k8s-ci-robot added 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 25, 2021
@@ -22,6 +22,7 @@ import (
"strings"

"k8s.io/klog"
"sigs.k8s.io/kubetest2/pkg/build"
Copy link
Member

Choose a reason for hiding this comment

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

nit: group with import below (this is a first party import)

@@ -23,6 +23,7 @@ import (
"strings"

"k8s.io/klog"
"sigs.k8s.io/kubetest2/pkg/build"
Copy link
Member

Choose a reason for hiding this comment

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

same here with import grouping, first party imports go in their own group

Copy link
Member

Choose a reason for hiding this comment

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

this also applies to other files

return t.Test()
}

// initializes relevant information from the well defined kubetest2 environment variables.
func (t *Tester) initKubetest2Info() {
t.runDir = os.Getenv("KUBETEST2_RUN_DIR")
Copy link
Member

Choose a reason for hiding this comment

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

no defaulting?

if err != nil {
return err
}
// make sure we close the file
Copy link
Member

Choose a reason for hiding this comment

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

why is this error reported but not in.Close() ?

pkg/app/app.go Outdated
@@ -124,6 +124,9 @@ func RealMain(opts types.Options, d types.Deployer, tester types.Tester) (result

envsForTester := os.Environ()
// We expose both ARIFACTS and KUBETEST2_RUN_DIR so we can more granular about caching vs output in future.
// also add run_dir to $PATH for locally built binaries
dollarPath := opts.RunDir() + string(filepath.ListSeparator) + os.Getenv("PATH")
Copy link
Member

Choose a reason for hiding this comment

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

nit: updatedPath, $ is specific to shell.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 25, 2021
Copy link
Contributor

@spiffxp spiffxp left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm
I have one nit but it can be done as followup

Comment on lines +76 to +77
var (
CommonTestBinaries = []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this needs to be a var?

Suggested change
var (
CommonTestBinaries = []string{
const (
CommonTestBinaries = []string{

Copy link
Contributor Author

Choose a reason for hiding this comment

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

go doesn't support array constants?
https://golang.org/ref/spec#Constants

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amwat, spiffxp

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 lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 25, 2021
@k8s-ci-robot k8s-ci-robot merged commit 9defa38 into kubernetes-sigs:master Feb 25, 2021
@amwat amwat deleted the kubectl-ginkgo branch February 25, 2021 20:44
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants