Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: make sure FLY_PREFLIGHT_TEST_FLY_REGIONS is used #4043

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/preflight/apps_v2_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ import (
"github.com/superfly/flyctl/test/preflight/testlib"
)

func TestAppsV2Example(t *testing.T) {
func TestAppsV2Example(tt *testing.T) {
t := testLogger{tt}

f := testlib.NewTestEnvFromEnv(t)
appName := f.CreateRandomAppName()
appUrl := fmt.Sprintf("https://%s.fly.dev", appName)

t.Logf("Launch %s in %s", appName, f.PrimaryRegion())
result := f.Fly(
"launch --org %s --name %s --region %s --image nginx --internal-port 80 --now --auto-confirm --ha=false",
f.OrgSlug(), appName, f.PrimaryRegion(),
Expand All @@ -34,6 +37,7 @@ func TestAppsV2Example(t *testing.T) {
require.Contains(f, result.StdOutString(), fmt.Sprintf("Created app '%s' in organization '%s'", appName, f.OrgSlug()))
require.Contains(f, result.StdOutString(), "Wrote config file fly.toml")

t.Logf("Check %s is running", appUrl)
require.Eventually(t, func() bool {
resp, err := http.Get(appUrl)
return err == nil && resp.StatusCode == http.StatusOK
Expand All @@ -59,6 +63,7 @@ func TestAppsV2Example(t *testing.T) {
if len(f.OtherRegions()) > 0 {
secondReg = f.OtherRegions()[0]
}
t.Logf("Clone to %s", secondReg)
f.Fly("m clone --region %s %s", secondReg, firstMachine.ID)

result = f.Fly("status")
Expand All @@ -68,6 +73,7 @@ func TestAppsV2Example(t *testing.T) {
if len(f.OtherRegions()) > 1 {
thirdReg = f.OtherRegions()[1]
}
t.Logf("Clone to %s", thirdReg)
f.Fly("m clone --region %s %s", thirdReg, firstMachine.ID)

result = f.Fly("status")
Expand Down
Loading