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) {
recipe := internal.ValidateRecipe(args, cmd.Name())
var version string
var recipeVersion string
if !internal.Chaos {
if err := recipe.EnsureIsClean(); err != nil {
log.Fatal(err)
@ -75,7 +75,6 @@ var AppNewCommand = &cobra.Command{
}
}
var recipeVersion string
if len(args) == 2 {
recipeVersion = args[1]
}
@ -89,10 +88,10 @@ var AppNewCommand = &cobra.Command{
if len(recipeVersions) > 0 {
latest := recipeVersions[len(recipeVersions)-1]
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)
}
} 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 {
log.Fatal(err)
}
@ -188,7 +195,7 @@ var AppNewCommand = &cobra.Command{
headers := []string{"SERVER", "DOMAIN", "RECIPE", "VERSION"}
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)
@ -221,8 +228,8 @@ var AppNewCommand = &cobra.Command{
log.Fatal(err)
}
log.Debugf("choosing %s as version to save to env file", version)
if err := app.WriteRecipeVersion(version, false); err != nil {
log.Debugf("choosing %s as version to save to env file", recipeVersion)
if err := app.WriteRecipeVersion(recipeVersion, false); err != nil {
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)
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"
assert_success
}
@ -65,7 +65,7 @@ teardown(){
currentHash=$(_get_current_hash)
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"
assert_success
}

View File

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