From a0670f69afea7c925b71bc3181d8ac8fc505bd29 Mon Sep 17 00:00:00 2001 From: Ilya Grishnov Date: Wed, 19 Apr 2023 16:03:17 +0300 Subject: [PATCH] bugfix: specifying confusing instance names Closes #763 --- cli/common/utils.go | 17 ----------------- cli/common/utils_test.go | 22 ---------------------- 2 files changed, 39 deletions(-) diff --git a/cli/common/utils.go b/cli/common/utils.go index dafa00c6d..3e3df09c7 100644 --- a/cli/common/utils.go +++ b/cli/common/utils.go @@ -382,16 +382,6 @@ func GetInstancesFromArgs(args []string, projectName string) ([]string, error) { var instances []string for _, instanceName := range args { - if instanceName == projectName { - return nil, fmt.Errorf(appNameSpecifiedError) - } - - parts := strings.SplitN(instanceName, ".", 2) - - if len(parts) > 1 { - return nil, fmt.Errorf(instanceIDSpecified) - } - if instanceName == "stateboard" { return nil, fmt.Errorf("Please, specify flag --stateboard for processing stateboard instance") } @@ -579,10 +569,3 @@ func ParseDependencies(rawDeps []string) (PackDependencies, error) { func ContainsUpperSymbols(src string) bool { return strings.ToLower(src) != src } - -const ( - appNameSpecifiedError = "Application name is specified. " + - "Please, specify instance name(s)" - instanceIDSpecified = `[APP_NAME].INSTANCE_NAME is specified. ` + - "Please, specify instance name(s)" -) diff --git a/cli/common/utils_test.go b/cli/common/utils_test.go index 60b845cf0..c40046a00 100644 --- a/cli/common/utils_test.go +++ b/cli/common/utils_test.go @@ -116,19 +116,6 @@ func TestGetInstancesFromArgs(t *testing.T) { projectName := "myapp" - // wrong format - args = []string{"myapp.instance-1", "myapp.instance-2"} - _, err = GetInstancesFromArgs(args, projectName) - assert.EqualError(err, instanceIDSpecified) - - args = []string{"instance-1", "myapp.instance-2"} - _, err = GetInstancesFromArgs(args, projectName) - assert.EqualError(err, instanceIDSpecified) - - args = []string{"myapp"} - _, err = GetInstancesFromArgs(args, projectName) - assert.True(strings.Contains(err.Error(), appNameSpecifiedError)) - // duplicate instance name args = []string{"instance-1", "instance-1"} _, err = GetInstancesFromArgs(args, projectName) @@ -139,15 +126,6 @@ func TestGetInstancesFromArgs(t *testing.T) { instances, err = GetInstancesFromArgs(args, projectName) assert.Nil(err) assert.Equal([]string{"instance-1", "instance-2"}, instances) - - // specified both app name and instance name - args = []string{"instance-1", "myapp"} - instances, err = GetInstancesFromArgs(args, projectName) - assert.EqualError(err, appNameSpecifiedError) - - args = []string{"myapp", "instance-1"} - instances, err = GetInstancesFromArgs(args, projectName) - assert.EqualError(err, appNameSpecifiedError) } func TestCorrectDependencyParsing(t *testing.T) {