mirror of https://github.com/helm/helm
internal/version and pkg/chart/common imported "testing" only to call testing.Testing(), pulling the testing package and its dependencies into release binaries. Replace those checks with exported KubeVersionMajorTesting / KubeVersionMinorTesting sentinels that default to zero. A new build-tagged file internal/version/version_helmtest.go seeds them in init() and only compiles under -tags helmtest. The Makefile applies -tags helmtest as a baseline so test-unit and test-coverage work directly or via `make test`. scripts/coverage.sh passes the tag to its raw `go test` call. CONTRIBUTING.md documents that contributors running tests outside the Makefile must pass the tag themselves. Signed-off-by: Evans Mungai <mbuevans@gmail.com>pull/32169/head
parent
4dec37abd2
commit
e8b053d999
@ -0,0 +1,31 @@
|
|||||||
|
//go:build helmtest
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The Helm Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package version
|
||||||
|
|
||||||
|
// This file is only compiled when the `helmtest` build tag is set (applied by
|
||||||
|
// the Makefile to all test invocations). It seeds the testing-version
|
||||||
|
// sentinels so that production code paths in this package and in
|
||||||
|
// pkg/chart/common substitute stable values instead of attempting to read
|
||||||
|
// build info from a `go test` binary (which has no module info and would
|
||||||
|
// panic during package init).
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
KubeVersionMajorTesting = 1
|
||||||
|
KubeVersionMinorTesting = 20
|
||||||
|
}
|
||||||
Loading…
Reference in new issue