diff --git a/cli/app/new.go b/cli/app/new.go index cdb543550..67b69d09d 100644 --- a/cli/app/new.go +++ b/cli/app/new.go @@ -112,7 +112,11 @@ var AppNewCommand = &cobra.Command{ } } - if len(recipeVersions) > 0 { + if recipeVersion != "" { + if _, err := recipe.EnsureVersion(recipeVersion); err != nil { + log.Fatal(err) + } + } else if len(recipeVersions) > 0 { latest := recipeVersions[len(recipeVersions)-1] for tag := range latest { recipeVersion = tag diff --git a/tests/integration/app_new.bats b/tests/integration/app_new.bats index c7721c3af..4ef94aacb 100644 --- a/tests/integration/app_new.bats +++ b/tests/integration/app_new.bats @@ -61,6 +61,16 @@ teardown(){ run grep -q "TYPE=$TEST_RECIPE:0.3.0+1.21.0" \ "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" assert_success + + # 0.3.0-only + run grep -q "NETWORK_WITH_COMMENT=BAZ" \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_success + + # latest-only + run grep -q "TIMEOUT=120" \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_failure } @test "ensure recipe is up-to-date" { @@ -100,6 +110,16 @@ teardown(){ run grep -q "TYPE=$TEST_RECIPE:${tagHash}" \ "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" assert_success + + # 0.3.0-only + run grep -q "NETWORK_WITH_COMMENT=BAZ" \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_success + + # latest-only + run grep -q "TIMEOUT=120" \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_failure } @test "does not overwrite existing env files" {