Skip to content

Commit

Permalink
Ginkgo v2 (#537)
Browse files Browse the repository at this point in the history
* go get ginkgov2, add changelog

* WIP - makefile changes

* update go

* add changelog

* 1.18.2

* changelog update

* Trigger CI

* update crypto to avoid cyclic dep

* use v2 cli, update makefile to match cli

* update kube libraries

* WIP

* Remove multicluster, update makefile

* WIP, remove dep on go-utils in tests

* fix file resource client test

* make clean, run all tests in CI

* upgrade go-utils

* handle context in consul tests

* delete multicluster test

* check races, recover from goroutines

* extend timeout for gorutine check

* move codegen validation out of cloudbuild to mirror other repos, into GHA

* Revert "move codegen validation out of cloudbuild o mirror other repos, into GHA"

This reverts commit 1448148.

* Trigger CI

* eventually

* terminate goroutine when context cacncelled

* use <= to track cleanup

* upgrade k8s-utils

* go and k8s utils

* udno k8s deletion

* remove clustername

* update go-control-plane ref

* equal -> consist of protos

* Update pkg/code-generator/codegen/templates/resource_client_test_template.go

Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io>

* Update pkg/code-generator/codegen/templates/event_loop_test_template.go

Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io>

* codegen

* cleanup makefile, make tests write to output dir

* update go-utiuls and k8s-utils

* small cleanup: makefile, imports, comments

* unpin klog

* use release version

* fix race in kube test

* use context in apiclient test

* fix reporter test

* Trigger CI

* ensure output dir exists

* clean all _output dirs

* fix race in kube test

* fix output pathing

* Update Makefile

Co-authored-by: Jacob Cukjati <jakecukjati@gmail.com>

* add comement around reporter test

* fix makefile

* fix path?

* relative

* undo cleanup of docgen, revert ot existing code

* delete bad chart

* update licenses

* Trigger CI

---------

Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io>
Co-authored-by: Jacob Cukjati <jakecukjati@gmail.com>
  • Loading branch information
3 people authored Feb 9, 2023
1 parent 2cef001 commit 9b38e31
Show file tree
Hide file tree
Showing 231 changed files with 910 additions and 5,227 deletions.
16 changes: 14 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
vendor*/
_output/
/solo-kit-gen
**/doc-gen-test-*
doc-gen-test*

# Output directory where we place most test assets
_output/

# Ginkgo test report output
test-report.json

# Ginkgo test coverage output
*.cov

# junit
junit.xml
junit-*.xml
89 changes: 67 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
# https://www.gnu.org/software/make/manual/html_node/Special-Variables.html#Special-Variables
.DEFAULT_GOAL := help

#----------------------------------------------------------------------------------
# Base
# Help
#----------------------------------------------------------------------------------
# Our Makefile is quite large, and hard to reason through
# `make help` can be used to self-document targets
# To update a target to be self-documenting (and appear with the `help` command),
# place a comment after the target that is prefixed by `##`. For example:
# custom-target: ## comment that will appear in the documentation when running `make help`
#
# **NOTE TO DEVELOPERS**
# As you encounter make targets that are frequently used, please make them self-documenting
.PHONY: help
help: FIRST_COLUMN_WIDTH=35
help: ## Output the self-documenting make targets
@grep -hE '^[%a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-$(FIRST_COLUMN_WIDTH)s\033[0m %s\n", $$1, $$2}'

#----------------------------------------------------------------------------------
# Base
#----------------------------------------------------------------------------------
ROOTDIR := $(shell pwd)
PACKAGE_PATH:=github.com/solo-io/solo-kit
OUTPUT_DIR ?= $(ROOTDIR)/_output
DEPSGOBIN:=$(OUTPUT_DIR)/.bin
SOURCES := $(shell find . -name "*.go" | grep -v test.go)

GO_BUILD_FLAGS := GO111MODULE=on CGO_ENABLED=0

# Important to use binaries built from module.
export PATH:=$(DEPSGOBIN):$(PATH)
export GOBIN:=$(DEPSGOBIN)

#----------------------------------------------------------------------------------
# Version, Release
#----------------------------------------------------------------------------------
Expand Down Expand Up @@ -36,7 +59,6 @@ init:

PROTOS := $(shell find api/v1 -name "*.proto")
GENERATED_PROTO_FILES := $(shell find pkg/api/v1/resources/core -name "*.pb.go")
DEPSGOBIN=$(shell pwd)/_output/.bin

.PHONY: update-all
update-all: mod-download update-deps update-code-generator
Expand All @@ -48,14 +70,13 @@ mod-download:
.PHONY: update-deps
update-deps:
mkdir -p $(DEPSGOBIN)
GOBIN=$(DEPSGOBIN) go install github.com/solo-io/protoc-gen-ext
GOBIN=$(DEPSGOBIN) go install github.com/solo-io/protoc-gen-openapi
GOBIN=$(DEPSGOBIN) go install golang.org/x/tools/cmd/goimports
GOBIN=$(DEPSGOBIN) go install github.com/golang/protobuf/protoc-gen-go
GOBIN=$(DEPSGOBIN) go install github.com/envoyproxy/protoc-gen-validate
GOBIN=$(DEPSGOBIN) go install github.com/golang/mock/gomock
GOBIN=$(DEPSGOBIN) go install github.com/golang/mock/mockgen
GOBIN=$(DEPSGOBIN) go install github.com/onsi/ginkgo/ginkgo
go install github.com/solo-io/protoc-gen-ext
go install github.com/solo-io/protoc-gen-openapi@v0.1.0
go install golang.org/x/tools/cmd/goimports
go install github.com/golang/protobuf/protoc-gen-go
go install github.com/envoyproxy/protoc-gen-validate
go install github.com/golang/mock/gomock
go install github.com/golang/mock/mockgen

.PHONY: update-code-generator
update-code-generator:
Expand Down Expand Up @@ -93,6 +114,12 @@ $(OUTPUT_DIR)/.clientset: $(GENERATED_PROTO_FILES) $(SOURCES)
# Generated Code
#----------------------------------------------------------------------------------

.PHONY: clean
clean:
rm -rf vendor_any
find . -type d -name "doc-gen-test*" -exec rm -rf {} + # remove all doc-gen-test* directories
find . -type d -name "_output" -exec rm -rf {} + # remove all _output directories

.PHONY: generate-all
generate-all: generated-code

Expand All @@ -101,32 +128,50 @@ generated-code: $(OUTPUT_DIR)/.generated-code update-licenses

SUBDIRS:=pkg test
$(OUTPUT_DIR)/.generated-code:
mkdir -p ${OUTPUT_DIR}
rm -rf vendor_any
mkdir -p $(OUTPUT_DIR)
go mod tidy
PATH=$(DEPSGOBIN):$$PATH $(GO_BUILD_FLAGS) go generate ./...
PATH=$(DEPSGOBIN):$$PATH gofmt -w $(SUBDIRS)
PATH=$(DEPSGOBIN):$$PATH goimports -w $(SUBDIRS)
$(GO_BUILD_FLAGS) go generate ./...
gofmt -w $(SUBDIRS)
goimports -w $(SUBDIRS)
touch $@

.PHONY: verify-envoy-protos
verify-envoy-protos:
@echo Verifying validity of generated envoy files...
PATH=$(DEPSGOBIN):$$PATH $(GO_BUILD_FLAGS) CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build pkg/api/external/verify.go

$(GO_BUILD_FLAGS) CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build pkg/api/external/verify.go

#----------------------------------------------------------------------------------
# Unit Tests
# Tests
#----------------------------------------------------------------------------------

# '-skip=multicluster', '-regexScansFilePath' skips any filepath which includes multicluster, which is useful
# as this code is no longer used
GINKGO_VERSION := 2.5.0
GINKGO_ENV ?= GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore ACK_GINKGO_DEPRECATIONS=$(GINKGO_VERSION)
GINKGO_FLAGS ?= -v -tags=purego -compilers=4 --randomize-all --trace -progress -race
GINKGO_REPORT_FLAGS ?= --json-report=test-report.json --junit-report=junit.xml -output-dir=$(OUTPUT_DIR)
GINKGO_COVERAGE_FLAGS ?= --cover --covermode=atomic --coverprofile=coverage.cov
TEST_PKG ?= ./... # Default to run all tests

# This is a way for a user executing `make test` to be able to provide flags which we do not include by default
# For example, you may want to run tests multiple times, or with various timeouts
GINKGO_USER_FLAGS ?=

.PHONY: install-test-tools
install-test-tools:
go install github.com/onsi/ginkgo/v2/ginkgo@v$(GINKGO_VERSION)

.PHONY: test
test:
test: install-test-tools ## Run all tests, or only run the test package at {TEST_PKG} if it is specified
ifneq ($(RELEASE), "true")
PATH=$(DEPSGOBIN):$$PATH ginkgo -r -v -race -p -tags solokit -compilers=2 -skip multicluster -regexScansFilePath -randomizeAllSpecs -randomizeSuites $(TEST_PKG)
$(GINKGO_ENV) ginkgo \
$(GINKGO_FLAGS) $(GINKGO_REPORT_FLAGS) $(GINKGO_USER_FLAGS) \
$(TEST_PKG)
endif

.PHONY: test-with-coverage
test-with-coverage: GINKGO_FLAGS += $(GINKGO_COVERAGE_FLAGS)
test-with-coverage: test
go tool cover -html $(OUTPUT_DIR)/coverage.cov

#----------------------------------------------------------------------------------
# Update third party licenses and check for GPL Licenses
#----------------------------------------------------------------------------------
Expand Down
40 changes: 0 additions & 40 deletions api/multicluster/v1/kubeconfig.go

This file was deleted.

22 changes: 0 additions & 22 deletions api/multicluster/v1/solo-kit.json

This file was deleted.

55 changes: 55 additions & 0 deletions changelog/v0.31.0/ginkgo-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
changelog:
- type: NON_USER_FACING
issueLink: https://github.com/solo-io/gloo/issues/7222
resolvesIssue: false
description: >
Upgrade Ginkgo from v1 to v2, using https://onsi.github.io/ginkgo/MIGRATING_TO_V2 as a helpful guide.
- type: BREAKING_CHANGE
issueLink: https://github.com/solo-io/gloo/issues/7222
resolvesIssue: false
description: >
Remove multicluster package, as it was not used by any projects
- type: DEPENDENCY_BUMP
dependencyOwner: solo-io
dependencyRepo: go-list-licenses
dependencyTag: v0.1.4
- type: DEPENDENCY_BUMP
dependencyOwner: solo-io
dependencyRepo: go-utils
dependencyTag: v0.24.0
- type: DEPENDENCY_BUMP
dependencyOwner: solo-io
dependencyRepo: k8s-utils
dependencyTag: v0.3.0
- type: DEPENDENCY_BUMP
dependencyOwner: solo-io
dependencyRepo: protoc-gen-ext
dependencyTag: v0.0.18
- type: DEPENDENCY_BUMP
dependencyOwner: onsi
dependencyRepo: ginkgo/v2
dependencyTag: v2.5.0
- type: DEPENDENCY_BUMP
dependencyOwner: onsi
dependencyRepo: gomega
dependencyTag: v1.24.1
- type: DEPENDENCY_BUMP
dependencyOwner: k8s.io
dependencyRepo: apiextensions-apiserver
dependencyTag: v0.25.4
- type: DEPENDENCY_BUMP
dependencyOwner: k8s.io
dependencyRepo: apimachinery
dependencyTag: v0.25.4
- type: DEPENDENCY_BUMP
dependencyOwner: k8s.io
dependencyRepo: client-go
dependencyTag: v0.25.4
- type: DEPENDENCY_BUMP
dependencyOwner: k8s.io
dependencyRepo: api
dependencyTag: v0.25.4
- type: DEPENDENCY_BUMP
dependencyOwner: k8s.io
dependencyRepo: code-generator
dependencyTag: v0.25.4
2 changes: 1 addition & 1 deletion ci/oss_compliance/osa_included.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name|Version|License
---|---|---
[consul/api](https://github.com/hashicorp/consul)|v1.1.0|Mozilla Public License 2.0
[hashicorp/go-multierror](https://github.com/hashicorp/go-multierror)|v1.0.0|Mozilla Public License 2.0
[hashicorp/go-multierror](https://github.com/hashicorp/go-multierror)|v1.1.1|Mozilla Public License 2.0
[vault/api](https://github.com/hashicorp/vault)|v1.0.5-0.20191108163347-bdd38fca2cff|Mozilla Public License 2.0
39 changes: 19 additions & 20 deletions ci/oss_compliance/osa_provided.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
Name|Version|License
---|---|---
[cuelang.org/go](https://cuelang.org/go)|v0.3.2|Apache License 2.0
[Masterminds/sprig](https://github.com/Masterminds/sprig)|v2.20.0+incompatible|MIT License
[Masterminds/sprig](https://github.com/Masterminds/sprig)|v2.22.0+incompatible|MIT License
[bugsnag/bugsnag-go](https://github.com/bugsnag/bugsnag-go)|v1.5.0|MIT License
[envoyproxy/go-control-plane](https://github.com/envoyproxy/go-control-plane)|v0.9.9-0.20210511190911-87d352569d55|Apache License 2.0
[envoyproxy/go-control-plane](https://github.com/envoyproxy/go-control-plane)|v0.10.2-0.20220325020618-49ff273808a1|Apache License 2.0
[envoyproxy/protoc-gen-validate](https://github.com/envoyproxy/protoc-gen-validate)|v0.4.0|Apache License 2.0
[fgrosse/zaptest](https://github.com/fgrosse/zaptest)|v1.1.0|MIT License
[getkin/kin-openapi](https://github.com/getkin/kin-openapi)|v0.80.0|MIT License
[ghodss/yaml](https://github.com/ghodss/yaml)|v1.0.1-0.20190212211648-25d852aebe32|MIT License
[go-test/deep](https://github.com/go-test/deep)|v1.0.2|MIT License
[golang/protobuf](https://github.com/golang/protobuf)|v1.5.2|BSD 3-clause "New" or "Revised" License
[grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware)|v1.0.1-0.20190118093823-f849b5445de4|Apache License 2.0
[grpc-ecosystem/go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware)|v1.3.0|Apache License 2.0
[iancoleman/strcase](https://github.com/iancoleman/strcase)|v0.0.0-20191112232945-16388991a334|MIT License
[ilackarms/protoc-gen-doc](https://github.com/ilackarms/protoc-gen-doc)|v1.0.0|MIT License
[mitchellh/hashstructure](https://github.com/mitchellh/hashstructure)|v1.0.0|MIT License
[onsi/ginkgo](https://github.com/onsi/ginkgo)|v1.16.5|MIT License
[onsi/gomega](https://github.com/onsi/gomega)|v1.16.0|MIT License
[ginkgo/v2](https://github.com/onsi/ginkgo)|v2.5.0|MIT License
[onsi/gomega](https://github.com/onsi/gomega)|v1.24.1|MIT License
[pkg/errors](https://github.com/pkg/errors)|v0.9.1|BSD 2-clause "Simplified" License
[pseudomuto/protoc-gen-doc](https://github.com/pseudomuto/protoc-gen-doc)|v1.5.1|MIT License
[pseudomuto/protokit](https://github.com/pseudomuto/protokit)|v0.2.0|MIT License
[radovskyb/watcher](https://github.com/radovskyb/watcher)|v1.0.2|BSD 3-clause "New" or "Revised" License
[rotisserie/eris](https://github.com/rotisserie/eris)|v0.1.1|MIT License
[go.opencensus.io](https://go.opencensus.io)|v0.22.4|Apache License 2.0
[go.uber.org/multierr](https://go.uber.org/multierr)|v1.4.0|MIT License
[go.uber.org/zap](https://go.uber.org/zap)|v1.13.0|MIT License
[x/sync](https://golang.org/x/sync)|v0.0.0-20201020160332-67f06af15bc9|BSD 3-clause "New" or "Revised" License
[google.golang.org/genproto](https://google.golang.org/genproto)|v0.0.0-20200825200019-8632dd797987|Apache License 2.0
[google.golang.org/grpc](https://google.golang.org/grpc)|v1.36.0|Apache License 2.0
[google.golang.org/protobuf](https://google.golang.org/protobuf)|v1.26.0|BSD 3-clause "New" or "Revised" License
[go.opencensus.io](https://go.opencensus.io)|v0.24.0|Apache License 2.0
[go.uber.org/zap](https://go.uber.org/zap)|v1.19.0|MIT License
[x/sync](https://golang.org/x/sync)|v0.1.0|BSD 3-clause "New" or "Revised" License
[google.golang.org/genproto](https://google.golang.org/genproto)|v0.0.0-20221201164419-0e50fba7f41c|Apache License 2.0
[google.golang.org/grpc](https://google.golang.org/grpc)|v1.51.0|Apache License 2.0
[google.golang.org/protobuf](https://google.golang.org/protobuf)|v1.28.1|BSD 3-clause "New" or "Revised" License
[gopkg.in/yaml.v2](https://gopkg.in/yaml.v2)|v2.4.0|Apache License 2.0
[k8s.io/api](https://k8s.io/api)|v0.18.6|Apache License 2.0
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.18.6|Apache License 2.0
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.18.6|Apache License 2.0
[k8s.io/client-go](https://k8s.io/client-go)|v0.18.6|Apache License 2.0
[k8s.io/code-generator](https://k8s.io/code-generator)|v0.18.6|Apache License 2.0
[k8s.io/utils](https://k8s.io/utils)|v0.0.0-20200603063816-c1c6865ac451|Apache License 2.0
[sigs.k8s.io/yaml](https://sigs.k8s.io/yaml)|v1.2.0|MIT License
[k8s.io/api](https://k8s.io/api)|v0.25.4|Apache License 2.0
[k8s.io/apiextensions-apiserver](https://k8s.io/apiextensions-apiserver)|v0.25.4|Apache License 2.0
[k8s.io/apimachinery](https://k8s.io/apimachinery)|v0.25.4|Apache License 2.0
[k8s.io/client-go](https://k8s.io/client-go)|v0.25.4|Apache License 2.0
[k8s.io/code-generator](https://k8s.io/code-generator)|v0.25.4|Apache License 2.0
[k8s.io/utils](https://k8s.io/utils)|v0.0.0-20220728103510-ee6ede2d64ed|Apache License 2.0
[sigs.k8s.io/yaml](https://sigs.k8s.io/yaml)|v1.3.0|MIT License
[cmd/goimports](https://golang.org/x/tools/cmd/goimports)|latest|MIT License
[gogo/protobuf](https://github.com/gogo/protobuf)|latest|MIT License
[envoyproxy/envoy](https://github.com/envoyproxy/envoy)|latest|Apache License 2.0
Expand Down
1 change: 1 addition & 0 deletions ci/tools.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build tools
// +build tools

/*
Expand Down
8 changes: 2 additions & 6 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ steps:
- name: 'gcr.io/$PROJECT_ID/e2e-go-mod-ginkgo:0.4.28'
entrypoint: 'bash'
env:
- 'ACK_GINKGO_RC=true'
- 'ACK_GINKGO_DEPRECATIONS=1.16.5'
- 'GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn'
- 'RUN_KUBE_TESTS=1'
- 'RUN_CONSUL_TESTS=1'
- 'RUN_VAULT_TESTS=1'
- 'TAGGED_VERSION=$TAG_NAME'
args: ['-c', 'make test']
waitFor: ['update-deps']
dir: *dir
Expand All @@ -66,8 +62,6 @@ steps:
- name: 'gcr.io/$PROJECT_ID/go-mod-make:0.4.28'
entrypoint: 'bash'
args: ['ci/check-code-gen.sh']
env:
- 'TAGGED_VERSION=$TAG_NAME'
waitFor: ['update-deps']
dir: *dir
id: 'check-code-and-docs-gen'
Expand All @@ -76,6 +70,8 @@ timeout: 1500s
tags: ['solo-kit']
options:
machineType: 'N1_HIGHCPU_32'
env:
- 'TAGGED_VERSION=$TAG_NAME'
volumes:
- name: 'gopath'
path: '/go'
Loading

0 comments on commit 9b38e31

Please sign in to comment.