Skip to content

Commit

Permalink
Add numerals to namespace and githubTeam input
Browse files Browse the repository at this point in the history
  • Loading branch information
poornima-krishnasamy committed Dec 20, 2023
1 parent a3e426b commit 4ea41bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/environment/githubTeamNameValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ type githubTeamNameValidator struct{}

func (v *githubTeamNameValidator) isValid(s string) bool {
r := new(regexValidator)
r.regex = `^[a-z\-]+$`
r.regex = `^[a-z0-9\-]+$`
return r.isValid(s)
}
2 changes: 1 addition & 1 deletion pkg/environment/namespaceNameValidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ type namespaceNameValidator struct{}

func (v *namespaceNameValidator) isValid(s string) bool {
r := new(regexValidator)
r.regex = `^[a-z\-]+$`
r.regex = `^[a-z0-9\-]+$`
return r.isValid(s)
}
12 changes: 6 additions & 6 deletions pkg/environment/templateEnvironment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ func TestReadAnswersFile(t *testing.T) {

func TestCreateNamespace(t *testing.T) {
ns := Namespace{
Namespace: "foobar",
Namespace: "foo2bar",
BusinessUnit: "My Biz Unit",
Environment: "envname",
Application: "My App",
Owner: "Some Team",
InfrastructureSupport: "[email protected]",
SourceCode: "https://github.com/ministryofjustice/somerepo",
GithubTeam: "my-github-team",
GithubTeam: "my-github-2-team",
SlackChannel: "my-team-slack_channel",
IsProduction: "false",
}
Expand All @@ -89,7 +89,7 @@ func TestCreateNamespace(t *testing.T) {
t.Errorf("Unexpected error: %s", err)
}

dir := namespaceBaseFolder + "/foobar/"
dir := namespaceBaseFolder + "/foo2bar/"
namespaceFile := dir + "00-namespace.yaml"
rbacFile := dir + "01-rbac.yaml"
variablesTfFile := dir + "resources/variables.tf"
Expand All @@ -112,17 +112,17 @@ func TestCreateNamespace(t *testing.T) {
}

stringsInFiles := map[string]string{
namespaceFile: "name: foobar",
namespaceFile: "name: foo2bar",
namespaceFile: "cloud-platform.justice.gov.uk/business-unit: \"My Biz Unit\"",
namespaceFile: "cloud-platform.justice.gov.uk/environment-name: \"envname\"",
namespaceFile: "cloud-platform.justice.gov.uk/application: \"My App\"",
namespaceFile: "cloud-platform.justice.gov.uk/owner: \"Some Team: [email protected]\"",
namespaceFile: "cloud-platform.justice.gov.uk/source-code: \"https://github.com/ministryofjustice/somerepo\"",
namespaceFile: "cloud-platform.justice.gov.uk/is-production: \"false\"",
namespaceFile: "pod-security.kubernetes.io/enforce: restricted",
rbacFile: "name: \"github:my-github-team\"",
rbacFile: "name: \"github:my-github-2-team\"",
variablesTfFile: "my-team-slack_channel",
variablesTfFile: "my-github-team",
variablesTfFile: "my-github-2-team",
}

for filename, searchString := range stringsInFiles {
Expand Down

0 comments on commit 4ea41bf

Please sign in to comment.