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

hack update: generate unit tests for new k8rs version #9708

Merged
merged 3 commits into from
Nov 17, 2020

Conversation

prezha
Copy link
Contributor

@prezha prezha commented Nov 15, 2020

fixes: #9694
ref: #9693

changelog:

  • modified hack/update 'suite' - added support to the schema for:

    • defining parametrised (templated) file paths
    • creating new files (in addition to updating just existing ones)
    • defining file content (eg, directly or by loading from an existing file) to be used (the content can also have template params)
  • modified update_kubernetes_version.go script additionally to:

    • update existing relevant kubeadm unit tests (testdata)
    • create a new set of testdata for new kubernetes version (major or minor) based on included template files (based, in turn, on existing v1.19 testdata), this is so that the 'suite' stays standalone - independent of other local files (eg, for remote github repo update only)
  • aob:

    • optimised update.ghUpdate() to range over schema instead of the whole tree.Entries

note:

example - output (with export UPDATE_TARGET="all"):

❯ go run update_kubernetes_version.go
I1115 03:43:24.295745   17952 update_kubernetes_version.go:140] Kubernetes versions: 'stable' is v1.19.4 and 'latest' is v1.20.0-beta.1
I1115 03:43:24.296470   17952 update.go:112] The Plan:
{
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/containerd-api-port.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/containerd-pod-network-cidr.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/containerd.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/crio-options-gates.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/crio.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/default.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/dns.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/image-repository.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/bootstrapper/bsutil/testdata/v1.20/options.yaml": {
    "replace": {
      "kubernetesVersion:.*": "kubernetesVersion: v1.20.0-beta.1"
    }
  },
  "pkg/minikube/constants/constants.go": {
    "replace": {
      "DefaultKubernetesVersion = \".*": "DefaultKubernetesVersion = \"v1.19.4\"",
      "NewestKubernetesVersion = \".*": "NewestKubernetesVersion = \"v1.20.0-beta.1\""
    }
  },
  "site/content/en/docs/commands/start.md": {
    "replace": {
      "'latest' for .*\\)": "'latest' for v1.20.0-beta.1)",
      "'stable' for .*,": "'stable' for v1.19.4,"
    }
  }
}
I1115 03:43:24.297118   17952 update.go:121] Local repo successfully updated
I1115 03:43:32.334144   17952 github.go:112] PR commit '28c5eee8ec234b60cabf83d9a9086269254261ff' successfully created: https://github.com/prezha/minikube/commit/28c5eee8ec234b60cabf83d9a9086269254261ff
I1115 03:43:33.050870   17952 github.go:126] PR branch 'update-kubernetes-version_28c5eee' successfully created: https://api.github.com/repos/prezha/minikube/git/refs/heads/update-kubernetes-version_28c5eee
I1115 03:43:34.421262   17952 update.go:145] PR successfully created: https://github.com/triplepoint-tech/minikube/pull/1

example - automatically created pr (not to be merged!):

triplepoint-tech#1

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 15, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @prezha. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 15, 2020
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

thanks for this PR, maybe we can organize the unit test data into Sub folders with their template version

hack/update/kubernetes_version/testdata_templates/containerd-pod-network-cidr.yaml

to

hack/update/kubernetes_version/templates/v1beta1/containerd-pod-network-cidr.yaml

@prezha
Copy link
Contributor Author

prezha commented Nov 16, 2020

thanks for this PR, maybe we can organize the unit test data into Sub folders with their template version

hack/update/kubernetes_version/testdata_templates/containerd-pod-network-cidr.yaml

to

hack/update/kubernetes_version/templates/v1beta1/containerd-pod-network-cidr.yaml

@medyagh thank you for your comments - it makes sense to group templates that way

i've renamed subfolders accordingly, just used hack/update/kubernetes_version/templates/v1beta2 as the root folder for this set of templates, assuming that you referred to the apiVersion, which is currently kubeadm.k8s.io/v1beta2?

@prezha prezha closed this Nov 16, 2020
@prezha prezha reopened this Nov 16, 2020
@prezha prezha requested a review from medyagh November 16, 2020 13:44
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh, prezha

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 Nov 17, 2020
@medyagh medyagh changed the title generate unit tests with kubernets version update hack update: generate unit tests for new k8rs version Nov 17, 2020
@medyagh medyagh merged commit a75cb32 into kubernetes:master Nov 17, 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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

update kubernets version script does not generate unit tests
4 participants