Skip to content

Commit

Permalink
Make applications subdomain configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Chico de Guzman <pchico83@gmail.com>
  • Loading branch information
pchico83 committed Nov 5, 2021
1 parent 598d956 commit af699b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions integration/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestPush(t *testing.T) {

log.Printf("pushed using %s \n", pushManifest)

endpoint := fmt.Sprintf("https://react-getting-started-%s.cloud.okteto.net", namespace)
endpoint := fmt.Sprintf("https://react-getting-started-%s.%s", namespace, appsSubdomain)
content, err := getContent(endpoint, 150, nil)
if err != nil {
t.Fatalf("failed to get app content: %s", err)
Expand All @@ -83,7 +83,7 @@ func TestPush(t *testing.T) {
t.Fatalf("error getting 'react-getting-started' deployment: %s", err.Error())
}

imageName := fmt.Sprintf("registry.cloud.okteto.net/%s/react-getting-started:okteto", namespace)
imageName := fmt.Sprintf("registry.%s/%s/react-getting-started:okteto", appsSubdomain, namespace)
if d.Spec.Template.Spec.Containers[0].Image != imageName {
t.Fatalf("wrong image built for okteto push: expected '%s', got '%s'", imageName, d.Spec.Template.Spec.Containers[0].Image)
}
Expand Down
6 changes: 3 additions & 3 deletions integration/stacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestStacks(t *testing.T) {

log.Printf("deployed stack using %s\n", stackManifest)

endpoint := fmt.Sprintf("https://vote-%s.cloud.okteto.net", namespace)
endpoint := fmt.Sprintf("https://vote-%s.%s", namespace, appsSubdomain)
content, err := getContent(endpoint, 150, nil)
if err != nil {
t.Fatalf("failed to get stack content: %s", err)
Expand Down Expand Up @@ -205,13 +205,13 @@ func TestCompose(t *testing.T) {

log.Printf("deployed stack using %s \n", "docker-compose.yml")

jobEndpoint := fmt.Sprintf("https://nginx-%s.cloud.okteto.net/db/initialized", namespace)
jobEndpoint := fmt.Sprintf("https://nginx-%s.%s/db/initialized", namespace, appsSubdomain)
content, err := getContent(jobEndpoint, 150, nil)
if err != nil {
t.Fatalf("failed to get stack content: %s", err)
}

endpoint := fmt.Sprintf("https://nginx-%s.cloud.okteto.net/db", namespace)
endpoint := fmt.Sprintf("https://nginx-%s.%s/db", namespace, appsSubdomain)
content, err = getContent(endpoint, 150, nil)
if err != nil {
t.Fatalf("failed to get stack content: %s", err)
Expand Down
9 changes: 7 additions & 2 deletions integration/up_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var (
user = ""
kubectlBinary = "kubectl"
zero int64 = 0
appsSubdomain = "cloud.okteto.net"
)

type deployment struct {
Expand Down Expand Up @@ -185,6 +186,10 @@ func TestMain(m *testing.M) {
user = u
}

if v := os.Getenv("OKTETO_APPS_SUBDOMAIN"); v != "" {
appsSubdomain = v
}

if runtime.GOOS == "windows" {
kubectlBinary = "kubectl.exe"
}
Expand Down Expand Up @@ -612,7 +617,7 @@ func TestDivert(t *testing.T) {
defer showUpLogs(name, namespace, t)

apiSvc := "catalog-chart"
originalContent, err := getContent(fmt.Sprintf("https://%s-%s.cloud.okteto.net/data", apiSvc, namespace), 150, upErrorChannel)
originalContent, err := getContent(fmt.Sprintf("https://%s-%s.%s/data", apiSvc, namespace, appsSubdomain), 150, upErrorChannel)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -693,7 +698,7 @@ func showUpLogs(name, namespace string, t *testing.T) {
func waitForDivertedContent(originalContent, namespace, apiSvc string, upErrorChannel chan error, timeout int) error {
for i := 0; i < timeout; i++ {
apiDivertedSvc := fmt.Sprintf("%s-%s", apiSvc, user)
divertedContent, err := getContent(fmt.Sprintf("https://%s-%s.cloud.okteto.net/data", apiDivertedSvc, namespace), 3, upErrorChannel)
divertedContent, err := getContent(fmt.Sprintf("https://%s-%s.%s/data", apiDivertedSvc, namespace, appsSubdomain), 3, upErrorChannel)
if err != nil {
continue
}
Expand Down

0 comments on commit af699b1

Please sign in to comment.