Commit 43fce8d6 authored by Dmitry Rozhkov's avatar Dmitry Rozhkov

e2e-node-tests: fix path to system specs

e2e-node tests may use custom system specs for validating nodes to conform the specs. The functionality is switched on when the tests are run with this command: make SYSTEM_SPEC_NAME=gke test-e2e-node Currently the command fails with the error: F1228 16:12:41.568836 34514 e2e_node_suite_test.go:106] Failed to load system spec: open /home/rojkov/go/src/k8s.io/kubernetes/k8s.io/kubernetes/cmd/kubeadm/app/util/system/specs/gke.yaml: no such file or directory Move the spec file under `test/e2e_node/system/specs` and introduce a single public constant referring the file to use instead of multiple private constants.
parent 5a708017
...@@ -204,6 +204,7 @@ filegroup( ...@@ -204,6 +204,7 @@ filegroup(
"//test/e2e_node/runner/local:all-srcs", "//test/e2e_node/runner/local:all-srcs",
"//test/e2e_node/runner/remote:all-srcs", "//test/e2e_node/runner/remote:all-srcs",
"//test/e2e_node/services:all-srcs", "//test/e2e_node/services:all-srcs",
"//test/e2e_node/system:all-srcs",
], ],
tags = ["automanaged"], tags = ["automanaged"],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
......
...@@ -20,6 +20,7 @@ go_library( ...@@ -20,6 +20,7 @@ go_library(
deps = [ deps = [
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//test/e2e_node/builder:go_default_library", "//test/e2e_node/builder:go_default_library",
"//test/e2e_node/system:go_default_library",
"//test/utils:go_default_library", "//test/utils:go_default_library",
"//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/klog:go_default_library",
], ],
......
...@@ -27,13 +27,10 @@ import ( ...@@ -27,13 +27,10 @@ import (
"k8s.io/klog" "k8s.io/klog"
"k8s.io/kubernetes/test/e2e_node/builder" "k8s.io/kubernetes/test/e2e_node/builder"
"k8s.io/kubernetes/test/e2e_node/system"
"k8s.io/kubernetes/test/utils" "k8s.io/kubernetes/test/utils"
) )
const (
systemSpecPath = "k8s.io/kubernetes/cmd/kubeadm/app/util/system/specs"
)
// NodeE2ERemote contains the specific functions in the node e2e test suite. // NodeE2ERemote contains the specific functions in the node e2e test suite.
type NodeE2ERemote struct{} type NodeE2ERemote struct{}
...@@ -75,7 +72,7 @@ func (n *NodeE2ERemote) SetupTestPackage(tardir, systemSpecName string) error { ...@@ -75,7 +72,7 @@ func (n *NodeE2ERemote) SetupTestPackage(tardir, systemSpecName string) error {
if systemSpecName != "" { if systemSpecName != "" {
// Copy system spec file // Copy system spec file
source := filepath.Join(rootDir, systemSpecPath, systemSpecName+".yaml") source := filepath.Join(rootDir, system.SystemSpecPath, systemSpecName+".yaml")
if _, err := os.Stat(source); err != nil { if _, err := os.Stat(source); err != nil {
return fmt.Errorf("failed to locate system spec %q: %v", source, err) return fmt.Errorf("failed to locate system spec %q: %v", source, err)
} }
......
...@@ -17,6 +17,7 @@ go_library( ...@@ -17,6 +17,7 @@ go_library(
importpath = "k8s.io/kubernetes/test/e2e_node/runner/local", importpath = "k8s.io/kubernetes/test/e2e_node/runner/local",
deps = [ deps = [
"//test/e2e_node/builder:go_default_library", "//test/e2e_node/builder:go_default_library",
"//test/e2e_node/system:go_default_library",
"//test/utils:go_default_library", "//test/utils:go_default_library",
"//vendor/k8s.io/klog:go_default_library", "//vendor/k8s.io/klog:go_default_library",
], ],
......
...@@ -25,6 +25,7 @@ import ( ...@@ -25,6 +25,7 @@ import (
"strings" "strings"
"k8s.io/kubernetes/test/e2e_node/builder" "k8s.io/kubernetes/test/e2e_node/builder"
"k8s.io/kubernetes/test/e2e_node/system"
"k8s.io/kubernetes/test/utils" "k8s.io/kubernetes/test/utils"
"k8s.io/klog" "k8s.io/klog"
...@@ -33,11 +34,7 @@ import ( ...@@ -33,11 +34,7 @@ import (
var buildDependencies = flag.Bool("build-dependencies", true, "If true, build all dependencies.") var buildDependencies = flag.Bool("build-dependencies", true, "If true, build all dependencies.")
var ginkgoFlags = flag.String("ginkgo-flags", "", "Space-separated list of arguments to pass to Ginkgo test runner.") var ginkgoFlags = flag.String("ginkgo-flags", "", "Space-separated list of arguments to pass to Ginkgo test runner.")
var testFlags = flag.String("test-flags", "", "Space-separated list of arguments to pass to node e2e test.") var testFlags = flag.String("test-flags", "", "Space-separated list of arguments to pass to node e2e test.")
var systemSpecName = flag.String("system-spec-name", "", "The name of the system spec used for validating the image in the node conformance test. The specs are at k8s.io/kubernetes/cmd/kubeadm/app/util/system/specs/. If unspecified, the default built-in spec (system.DefaultSpec) will be used.") var systemSpecName = flag.String("system-spec-name", "", fmt.Sprintf("The name of the system spec used for validating the image in the node conformance test. The specs are at %s. If unspecified, the default built-in spec (system.DefaultSpec) will be used.", system.SystemSpecPath))
const (
systemSpecPath = "k8s.io/kubernetes/cmd/kubeadm/app/util/system/specs"
)
func main() { func main() {
klog.InitFlags(nil) klog.InitFlags(nil)
...@@ -65,7 +62,7 @@ func main() { ...@@ -65,7 +62,7 @@ func main() {
if err != nil { if err != nil {
klog.Fatalf("Failed to get k8s root directory: %v", err) klog.Fatalf("Failed to get k8s root directory: %v", err)
} }
systemSpecFile := filepath.Join(rootDir, systemSpecPath, *systemSpecName+".yaml") systemSpecFile := filepath.Join(rootDir, system.SystemSpecPath, *systemSpecName+".yaml")
args = append(args, fmt.Sprintf("--system-spec-name=%s --system-spec-file=%s", *systemSpecName, systemSpecFile)) args = append(args, fmt.Sprintf("--system-spec-name=%s --system-spec-file=%s", *systemSpecName, systemSpecFile))
} }
if err := runCommand(ginkgo, args...); err != nil { if err := runCommand(ginkgo, args...); err != nil {
......
...@@ -17,6 +17,7 @@ go_library( ...@@ -17,6 +17,7 @@ go_library(
importpath = "k8s.io/kubernetes/test/e2e_node/runner/remote", importpath = "k8s.io/kubernetes/test/e2e_node/runner/remote",
deps = [ deps = [
"//test/e2e_node/remote:go_default_library", "//test/e2e_node/remote:go_default_library",
"//test/e2e_node/system:go_default_library",
"//vendor/github.com/pborman/uuid:go_default_library", "//vendor/github.com/pborman/uuid:go_default_library",
"//vendor/golang.org/x/oauth2:go_default_library", "//vendor/golang.org/x/oauth2:go_default_library",
"//vendor/golang.org/x/oauth2/google:go_default_library", "//vendor/golang.org/x/oauth2/google:go_default_library",
......
...@@ -36,6 +36,7 @@ import ( ...@@ -36,6 +36,7 @@ import (
"time" "time"
"k8s.io/kubernetes/test/e2e_node/remote" "k8s.io/kubernetes/test/e2e_node/remote"
"k8s.io/kubernetes/test/e2e_node/system"
"github.com/pborman/uuid" "github.com/pborman/uuid"
"golang.org/x/oauth2" "golang.org/x/oauth2"
...@@ -61,7 +62,7 @@ var buildOnly = flag.Bool("build-only", false, "If true, build e2e_node_test.tar ...@@ -61,7 +62,7 @@ var buildOnly = flag.Bool("build-only", false, "If true, build e2e_node_test.tar
var instanceMetadata = flag.String("instance-metadata", "", "key/value metadata for instances separated by '=' or '<', 'k=v' means the key is 'k' and the value is 'v'; 'k<p' means the key is 'k' and the value is extracted from the local path 'p', e.g. k1=v1,k2<p2") var instanceMetadata = flag.String("instance-metadata", "", "key/value metadata for instances separated by '=' or '<', 'k=v' means the key is 'k' and the value is 'v'; 'k<p' means the key is 'k' and the value is extracted from the local path 'p', e.g. k1=v1,k2<p2")
var gubernator = flag.Bool("gubernator", false, "If true, output Gubernator link to view logs") var gubernator = flag.Bool("gubernator", false, "If true, output Gubernator link to view logs")
var ginkgoFlags = flag.String("ginkgo-flags", "", "Passed to ginkgo to specify additional flags such as --skip=.") var ginkgoFlags = flag.String("ginkgo-flags", "", "Passed to ginkgo to specify additional flags such as --skip=.")
var systemSpecName = flag.String("system-spec-name", "", "The name of the system spec used for validating the image in the node conformance test. The specs are at k8s.io/kubernetes/cmd/kubeadm/app/util/system/specs/. If unspecified, the default built-in spec (system.DefaultSpec) will be used.") var systemSpecName = flag.String("system-spec-name", "", fmt.Sprintf("The name of the system spec used for validating the image in the node conformance test. The specs are at %s. If unspecified, the default built-in spec (system.DefaultSpec) will be used.", system.SystemSpecPath))
// envs is the type used to collect all node envs. The key is the env name, // envs is the type used to collect all node envs. The key is the env name,
// and the value is the env value // and the value is the env value
......
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["specs.go"],
importpath = "k8s.io/kubernetes/test/e2e_node/system",
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
/*
Copyright 2019 The Kubernetes 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 system
const (
// SystemSpecPath is a path to spec files used for performing node conformance tests.
SystemSpecPath = "test/e2e_node/system/specs"
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment