fix: moar integration test patches
All checks were successful
continuous-integration/drone/push Build is passing

See toolshed/organising#650
This commit is contained in:
decentral1se 2024-12-27 21:55:01 +01:00
parent efb3fd8759
commit 4e8995cc0e
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
3 changed files with 17 additions and 11 deletions

View File

@ -64,7 +64,7 @@ var AppNewCommand = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
recipe := internal.ValidateRecipe(args, cmd.Name()) recipe := internal.ValidateRecipe(args, cmd.Name())
var version string var recipeVersion string
if !internal.Chaos { if !internal.Chaos {
if err := recipe.EnsureIsClean(); err != nil { if err := recipe.EnsureIsClean(); err != nil {
log.Fatal(err) log.Fatal(err)
@ -75,7 +75,6 @@ var AppNewCommand = &cobra.Command{
} }
} }
var recipeVersion string
if len(args) == 2 { if len(args) == 2 {
recipeVersion = args[1] recipeVersion = args[1]
} }
@ -89,10 +88,10 @@ var AppNewCommand = &cobra.Command{
if len(recipeVersions) > 0 { if len(recipeVersions) > 0 {
latest := recipeVersions[len(recipeVersions)-1] latest := recipeVersions[len(recipeVersions)-1]
for tag := range latest { for tag := range latest {
version = tag recipeVersion = tag
} }
if _, err := recipe.EnsureVersion(version); err != nil { if _, err := recipe.EnsureVersion(recipeVersion); err != nil {
log.Fatal(err) log.Fatal(err)
} }
} else { } else {
@ -107,6 +106,14 @@ var AppNewCommand = &cobra.Command{
} }
} }
if internal.Chaos && recipeVersion == "" {
var err error
recipeVersion, err = recipe.ChaosVersion()
if err != nil {
log.Fatal(err)
}
}
if err := ensureServerFlag(); err != nil { if err := ensureServerFlag(); err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -188,7 +195,7 @@ var AppNewCommand = &cobra.Command{
headers := []string{"SERVER", "DOMAIN", "RECIPE", "VERSION"} headers := []string{"SERVER", "DOMAIN", "RECIPE", "VERSION"}
table.Headers(headers...) table.Headers(headers...)
table.Row(newAppServer, appDomain, recipe.Name, version) table.Row(newAppServer, appDomain, recipe.Name, recipeVersion)
log.Infof("new app '%s' created 🌞", recipe.Name) log.Infof("new app '%s' created 🌞", recipe.Name)
@ -221,8 +228,8 @@ var AppNewCommand = &cobra.Command{
log.Fatal(err) log.Fatal(err)
} }
log.Debugf("choosing %s as version to save to env file", version) log.Debugf("choosing %s as version to save to env file", recipeVersion)
if err := app.WriteRecipeVersion(version, false); err != nil { if err := app.WriteRecipeVersion(recipeVersion, false); err != nil {
log.Fatalf("writing new recipe version in env file: %s", err) log.Fatalf("writing new recipe version in env file: %s", err)
} }
}, },

View File

@ -49,7 +49,7 @@ teardown(){
assert_equal $(_get_tag_hash 0.3.0+1.21.0) $(_get_current_hash) assert_equal $(_get_tag_hash 0.3.0+1.21.0) $(_get_current_hash)
run grep -q "RECIPE=$TEST_RECIPE:0.3.0+1.21.0" \ run grep -q "TYPE=$TEST_RECIPE:0.3.0+1.21.0" \
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
assert_success assert_success
} }
@ -65,7 +65,7 @@ teardown(){
currentHash=$(_get_current_hash) currentHash=$(_get_current_hash)
assert_equal 1e83340e ${currentHash:0:8} assert_equal 1e83340e ${currentHash:0:8}
run grep -q "RECIPE=$TEST_RECIPE:1e83340e" \ run grep -q "TYPE=$TEST_RECIPE:1e83340e" \
"$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env"
assert_success assert_success
} }

View File

@ -231,8 +231,7 @@ teardown(){
run $ABRA app secret rm "$TEST_APP_DOMAIN" test_pass_one --all run $ABRA app secret rm "$TEST_APP_DOMAIN" test_pass_one --all
assert_failure assert_failure
assert_output --partial 'cannot use' assert_output --regexp 'cannot use .* together'
assert_output --partial "'--all' together"
} }
@test "rm: single secret no match" { @test "rm: single secret no match" {