Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
restore ORCHESTRATOR_RELEASE for ginkgo E2E (#1993)
Browse files Browse the repository at this point in the history
* restore ORCHESTRATOR_RELEASE

* improved version detection for dashboard test
  • Loading branch information
jackfrancis committed Jan 4, 2018
1 parent 680360d commit cc930c7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
16 changes: 14 additions & 2 deletions test/e2e/engine/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Config struct {
AgentDNSPrefix string `envconfig:"DNS_PREFIX"`
PublicSSHKey string `envconfig:"PUBLIC_SSH_KEY"`
WindowsAdminPasssword string `envconfig:"WINDOWS_ADMIN_PASSWORD"`
OrchestratorRelease string `envconfig:"ORCHESTRATOR_RELEASE"`
OrchestratorVersion string `envconfig:"ORCHESTRATOR_VERSION"`
OutputDirectory string `envconfig:"OUTPUT_DIR" default:"_output"`
CreateVNET bool `envconfig:"CREATE_VNET" default:"false"`
Expand Down Expand Up @@ -98,8 +99,19 @@ func Build(cfg *config.Config, subnetID string) (*Engine, error) {
cs.ContainerService.Properties.WindowsProfile.AdminPassword = config.WindowsAdminPasssword
}

if config.OrchestratorVersion != "" {
cs.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion = config.OrchestratorVersion
// If the parsed api model input has no expressed version opinion, we check if ENV does have an opinion
if cs.ContainerService.Properties.OrchestratorProfile.OrchestratorRelease == "" &&
cs.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion == "" {
// First, prefer the release string if ENV declares it
if config.OrchestratorRelease != "" {
cs.ContainerService.Properties.OrchestratorProfile.OrchestratorRelease = config.OrchestratorRelease
// Or, choose the version string if ENV declares it
} else if config.OrchestratorVersion != "" {
cs.ContainerService.Properties.OrchestratorProfile.OrchestratorVersion = config.OrchestratorVersion
// If ENV similarly has no version opinion, we will rely upon the acs-engine default
} else {
log.Println("No orchestrator version specified, will use the default.")
}
}

if config.CreateVNET {
Expand Down
22 changes: 18 additions & 4 deletions test/e2e/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"time"

"github.com/Azure/acs-engine/pkg/api/common"
Expand Down Expand Up @@ -62,11 +63,20 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
version, err := node.Version()
Expect(err).NotTo(HaveOccurred())

if eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorVersion != "" {
Expect(version).To(MatchRegexp("v" + eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorVersion))
var expectedVersion string
if eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorRelease != "" ||
eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorVersion != "" {
expectedVersion = common.RationalizeReleaseAndVersion(
common.Kubernetes,
eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorRelease,
eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorVersion)
} else {
Expect(version).To(Equal("v" + common.KubernetesDefaultVersion))
expectedVersion = common.RationalizeReleaseAndVersion(
common.Kubernetes,
eng.Config.OrchestratorRelease,
eng.Config.OrchestratorVersion)
}
Expect(version).To(Equal("v" + expectedVersion))
})

It("should have kube-dns running", func() {
Expand Down Expand Up @@ -135,7 +145,11 @@ var _ = Describe("Azure Container Cluster using the Kubernetes Orchestrator", fu
s, err := service.Get("kubernetes-dashboard", "kube-system")
Expect(err).NotTo(HaveOccurred())
dashboardPort := 80
if eng.ClusterDefinition.Properties.OrchestratorProfile.OrchestratorRelease == "1.9" {
version, err := node.Version()
Expect(err).NotTo(HaveOccurred())

re := regexp.MustCompile("v1.9")
if re.FindString(version) != "" {
dashboardPort = 443
}
port := s.GetNodePort(dashboardPort)
Expand Down

0 comments on commit cc930c7

Please sign in to comment.