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

fix onprem determine bkp config #8053

Merged
merged 5 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ func determineDBType(a2ConfigMap map[string]*dc.AutomateConfig, dbtype string) (
return "", errors.New("automate config error found")
}
}
} else {
return "", errors.New("db type neither aws nor self-managed")
} else if dbtype == "" {
return dbtype, nil
}
return dbtype, nil
return "", errors.New(`unsupported db type. It should be either "aws" or "self-managed" or ""`)
}

func (p *PullConfigsImpl) fetchInfraConfig() (*ExistingInfraConfigToml, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,30 @@ func TestDetermineDBType(t *testing.T) {
},
dbtype: "old_type",
expectedType: "old_type",
expectedErr: errors.New("db type neither aws nor self-managed"),
expectedErr: errors.New(`unsupported db type. It should be either "aws" or "self-managed" or ""`),
},
{
name: "When invalid type comes in db type",
a2ConfigMap: map[string]*dc.AutomateConfig{
"config1": {
Global: &shared.GlobalConfig{
V1: &shared.V1{
External: &shared.External{
Opensearch: &shared.External_Opensearch{
Auth: &shared.External_Opensearch_Authentication{
Scheme: &wrapperspb.StringValue{
Value: "aws_os",
},
},
},
},
},
},
},
},
dbtype: "",
expectedType: "",
expectedErr: nil,
},
{
name: "When scheme is invalid",
Expand Down