Skip to content

Commit

Permalink
Update Golang to 1.16.2 (gardener#3739)
Browse files Browse the repository at this point in the history
* Upgrade to Golang 1.16.2

* Replace packr with go:embed

* Replace go-bindata with go:embed
  • Loading branch information
rfranzke authored Mar 22, 2021
1 parent 8a51383 commit c50704b
Show file tree
Hide file tree
Showing 122 changed files with 95 additions and 7,683 deletions.
2 changes: 1 addition & 1 deletion .test-defs/CreateManagedSeed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ spec:
-shoot-name=$SHOOT_NAME
-deploy-gardenlet=$DEPLOY_GARDENLET
-backup-provider=$BACKUP_PROVIDER
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/CreateShoot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ spec:
# -machine-type=$MACHINE_TYPE
# -external-domain=

image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/DeleteManagedSeed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ spec:
--v -ginkgo.v -ginkgo.progress -ginkgo.noColor
-kubecfg="$TM_KUBECONFIG_PATH/gardener.config"
-managed-seed-name=$MANAGED_SEED_NAME
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/DeleteShoot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
--project-namespace=$PROJECT_NAMESPACE
--kubecfg="$TM_KUBECONFIG_PATH/gardener.config"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/HibernateShoot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
--project-namespace=$PROJECT_NAMESPACE
--kubecfg="$TM_KUBECONFIG_PATH/gardener.config"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/MigrateShoot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ spec:
-shoot-namespace=$PROJECT_NAMESPACE
-kubecfg="$TM_KUBECONFIG_PATH/gardener.config"
-mr-exclude-list="$MR_EXCLUDE_LIST"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/ReconcileShoots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
-kubecfg=$TM_KUBECONFIG_PATH/gardener.config
-version=$GARDENER_VERSION
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/ShootKubernetesUpdateTest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ spec:
-shoot-name=$SHOOT_NAME
-project-namespace=$PROJECT_NAMESPACE
-version=$K8S_VERSION
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteGardenerBeta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ spec:
-ginkgo.focus="\[BETA\]"
-ginkgo.skip="\[SERIAL\]|\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteGardenerBetaSerial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
-ginkgo.focus="\[BETA\].*\[SERIAL\]"
-ginkgo.skip="\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteGardenerDefault.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ spec:
-ginkgo.focus="\[DEFAULT\]"
-ginkgo.skip="\[SERIAL\]|\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteGardenerDefaultSerial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
-ginkgo.focus="\[DEFAULT\].*\[SERIAL\]"
-ginkgo.skip="\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteGardenerRelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ spec:
-ginkgo.focus="\[RELEASE\]"
-ginkgo.skip="\[SERIAL\]|\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteGardenerReleaseSerial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
-ginkgo.focus="\[RELEASE\].*\[SERIAL\]"
-ginkgo.skip="\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootBeta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
-ginkgo.focus="\[BETA\]"
-ginkgo.skip="\[SERIAL\]|\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootBetaDisruptive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ spec:
-ginkgo.focus="\[BETA\].*\[DISRUPTIVE\]"
-ginkgo.skip="\[SERIAL\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootBetaSerial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ spec:
-ginkgo.focus="\[BETA\].*\[SERIAL\]"
-ginkgo.skip="\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootDefault.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
-ginkgo.focus="\[DEFAULT\]"
-ginkgo.skip="\[SERIAL\]|\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootDefaultDisruptive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ spec:
-ginkgo.focus="\[DEFAULT\].*\[DISRUPTIVE\]"
-ginkgo.skip="\[SERIAL\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootDefaultSerial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ spec:
-ginkgo.focus="\[DEFAULT\].*\[SERIAL\]"
-ginkgo.skip="\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootRelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ spec:
-ginkgo.focus="\[RELEASE\]"
-ginkgo.skip="\[SERIAL\]|\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootReleaseDisruptive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ spec:
-ginkgo.focus="\[RELEASE\].*\[DISRUPTIVE\]"
-ginkgo.skip="\[SERIAL\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/TestSuiteShootReleaseSerial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ spec:
-ginkgo.focus="\[RELEASE\].*\[SERIAL\]"
-ginkgo.skip="\[DISRUPTIVE\]"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion .test-defs/WakeUpShoot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
--project-namespace=$PROJECT_NAMESPACE
--kubecfg="$TM_KUBECONFIG_PATH/gardener.config"
image: golang:1.15.3
image: golang:1.16.2
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
############# builder #############
ARG GCR_PULL_URL=eu.gcr.io/gardener-project/3rd/
FROM ${GCR_PULL_URL}golang:1.15.9 AS builder
FROM ${GCR_PULL_URL}golang:1.16.2 AS builder

WORKDIR /go/src/github.com/gardener/gardener
COPY . .
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ install-requirements:
@go install -mod=vendor github.com/ahmetb/gen-crd-api-reference-docs
@go install -mod=vendor github.com/golang/mock/mockgen
@go install -mod=vendor sigs.k8s.io/controller-tools/cmd/controller-gen
@GO111MODULE=off go get github.com/go-bindata/go-bindata/...
@./hack/install-promtool.sh
@./hack/install-requirements.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ in a test file.
Each Generator implementation can use this function as shown bellow:

```go
package my_generator_test

import (
"github.com/gobuffalo/packr"
"embed"

"github.com/gardener/gardener/extensions/pkg/controller/operatingsystemconfig/oscommon/generator/test"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ Describe("My Generator Test", func(){
var box packr.Box

BeforeSuite(func() {
box = packr.NewBox("/path/to/testfiles")
})
//go:embed /path/to/testfiles
var files embed.FS

Describe("Conformance Tests", test.DescribeTest(NewGenerator(),box))
var _ = Describe("My Generator Test", func(){
Describe("Conformance Tests",
test.DescribeTest(NewGenerator(), files),
)

Describe("My other Tests", func(){
...
})
Describe("My other Tests", func(){
// ...
})
})
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
package test

import (
"embed"

"github.com/gardener/gardener/extensions/pkg/controller/operatingsystemconfig/oscommon/generator"
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"

"github.com/gobuffalo/packr"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var (
Expand All @@ -29,13 +30,12 @@ var (

// DescribeTest returns a function which can be used in tests for the
// template generator implementation. It receives an instance of a template
// generator and a packr Box with the test files to be used in the tests.
var DescribeTest = func(g generator.Generator, box packr.Box) func() {
// generator and embedded files with the test files to be used in the tests.
var DescribeTest = func(g generator.Generator, files embed.FS) func() {
return func() {

ginkgo.It("should render correctly", func() {
expectedCloudInit, err := box.Find("cloud-init")
gomega.Expect(err).NotTo(gomega.HaveOccurred())
It("should render correctly", func() {
expectedCloudInit, err := files.ReadFile("cloud-init")
Expect(err).NotTo(HaveOccurred())

cloudInit, _, err := g.Generate(&generator.OperatingSystemConfig{
Object: &extensionsv1alpha1.OperatingSystemConfig{},
Expand All @@ -62,8 +62,8 @@ var DescribeTest = func(g generator.Generator, box packr.Box) func() {
Bootstrap: true,
})

gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(cloudInit).To(gomega.Equal(expectedCloudInit))
Expect(err).NotTo(HaveOccurred())
Expect(cloudInit).To(Equal(expectedCloudInit))
})
}
}
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gardener/gardener

go 1.15
go 1.16

require (
github.com/Masterminds/semver v1.5.0
Expand All @@ -16,7 +16,6 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v0.3.0
github.com/go-openapi/spec v0.19.3
github.com/gobuffalo/packr v1.30.1
github.com/gogo/protobuf v1.3.1
github.com/golang/mock v1.5.0
github.com/googleapis/gnostic v0.5.1
Expand Down
Loading

0 comments on commit c50704b

Please sign in to comment.