Unverified Commit 7db6597f authored by bryanl's avatar bryanl
Browse files

Updating e2e tests/output



* package versions are SHA1 instead of tag name
* strip extra info off server versions before comparing
* ensure Kubernetes version is retained when updating environment namespace or name
Signed-off-by: default avatarbryanl <bryanliles@gmail.com>
parent da53bf18
......@@ -126,17 +126,20 @@ func setEnvListRow(in []envListRow, name, k8sVersion, namespace, override, serve
}
func genIncubatorPkgList() []pkgListRow {
// TODO: is there a better way to set this?
version := "40285d8a14f1ac5787e405e1023cf0c07f6aa28c"
return []pkgListRow{
{Registry: "incubator", Name: "apache", Version: "master", Installed: ""},
{Registry: "incubator", Name: "efk", Version: "master", Installed: ""},
{Registry: "incubator", Name: "mariadb", Version: "master", Installed: ""},
{Registry: "incubator", Name: "memcached", Version: "master", Installed: ""},
{Registry: "incubator", Name: "mongodb", Version: "master", Installed: ""},
{Registry: "incubator", Name: "mysql", Version: "master", Installed: ""},
{Registry: "incubator", Name: "nginx", Version: "master", Installed: ""},
{Registry: "incubator", Name: "node", Version: "master", Installed: ""},
{Registry: "incubator", Name: "postgres", Version: "master", Installed: ""},
{Registry: "incubator", Name: "redis", Version: "master", Installed: ""},
{Registry: "incubator", Name: "tomcat", Version: "master", Installed: ""},
{Registry: "incubator", Name: "apache", Version: version, Installed: ""},
{Registry: "incubator", Name: "efk", Version: version, Installed: ""},
{Registry: "incubator", Name: "mariadb", Version: version, Installed: ""},
{Registry: "incubator", Name: "memcached", Version: version, Installed: ""},
{Registry: "incubator", Name: "mongodb", Version: version, Installed: ""},
{Registry: "incubator", Name: "mysql", Version: version, Installed: ""},
{Registry: "incubator", Name: "nginx", Version: version, Installed: ""},
{Registry: "incubator", Name: "node", Version: version, Installed: ""},
{Registry: "incubator", Name: "postgres", Version: version, Installed: ""},
{Registry: "incubator", Name: "redis", Version: version, Installed: ""},
{Registry: "incubator", Name: "tomcat", Version: version, Installed: ""},
}
}
......@@ -22,8 +22,10 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/ksonnet/ksonnet/pkg/util/strings"
"github.com/blang/semver"
ksstrings "github.com/ksonnet/ksonnet/pkg/util/strings"
"github.com/pkg/errors"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
......@@ -75,11 +77,15 @@ func (e *e2e) serverVersion() string {
versionInfo, err := discoveryClient.ServerVersion()
Expect(err).ToNot(HaveOccurred(), "retrieve server version info")
return versionInfo.String()
v, err := semver.Make(strings.TrimPrefix(versionInfo.String(), "v"))
Expect(err).ToNot(HaveOccurred(), "parse server version")
return fmt.Sprintf("v%d.%d.%d",
v.Major, v.Minor, v.Patch)
}
func (e *e2e) createNamespace() string {
name := fmt.Sprintf("ks-e2e-%s", strings.LowerRand(6))
name := fmt.Sprintf("ks-e2e-%s", ksstrings.LowerRand(6))
c, err := corev1.NewForConfig(e.restConfig)
Expect(err).ToNot(HaveOccurred())
......@@ -154,7 +160,7 @@ func (e *e2e) buildKs() {
}
func (e *e2e) initApp(options *initOptions) app {
appID := strings.Rand(6)
appID := ksstrings.Rand(6)
appDir := filepath.Join(e.root, appID)
opts := []string{
......
......@@ -121,7 +121,7 @@ func (es *EnvSet) updateName(isOverride bool) error {
// updateEnvConfig merges the provided environment config with optional override settings and the creates and saves a new environment config based on the provided
// base configuration. It will be merged with the provided configuration settings.
// If isOverride is specified, Libaries will be filtered out of the merged configuration, as those should always be
// If isOverride is specified, Libraries will be filtered out of the merged configuration, as those should always be
// managed in the primary application config.
func (es *EnvSet) updateEnvConfig(env app.EnvironmentConfig, namespace, server, k8sAPISpec string, isOverride bool) error {
if env.Name == "" {
......@@ -132,8 +132,7 @@ func (es *EnvSet) updateEnvConfig(env app.EnvironmentConfig, namespace, server,
return nil
}
var newEnv app.EnvironmentConfig
newEnv = env // this is a copy
newEnv := env
var destination *app.EnvironmentDestinationSpec
if env.Destination != nil {
......@@ -152,11 +151,10 @@ func (es *EnvSet) updateEnvConfig(env app.EnvironmentConfig, namespace, server,
}
newEnv.Destination = destination
newEnv.KubernetesVersion = k8sAPISpec
// isOverride will be set by app.AddEnvironment
// isOverride will be set by app.AddEnvironment
if isOverride {
// Libaries will always derive from the primary app.yaml
// Libraries will always derive from the primary app.yaml
newEnv.Libraries = nil
}
......
......@@ -118,7 +118,6 @@ func TestEnvSet(t *testing.T) {
saveFn: func(t *testing.T) saveFn {
return func(a app.App, envName, k8sAPISpec string, spec *app.EnvironmentConfig, override bool) error {
assert.Equal(t, newk8sAPISpec, k8sAPISpec)
assert.Equal(t, newk8sAPISpec, spec.KubernetesVersion)
return nil
}
},
......@@ -141,7 +140,6 @@ func TestEnvSet(t *testing.T) {
Namespace: namespace,
Server: server,
},
KubernetesVersion: newk8sAPISpec,
}, spec)
assert.Equal(t, newk8sAPISpec, k8sAPISpec)
return nil
......
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