Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 6646319

Browse files
authored
Merge pull request #314 from galasa-dev/ash-cps-property
CPS property name now accepts @ symbol
2 parents fcc6442 + 5d7c323 commit 6646319

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

pkg/errors/errorMessage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ var (
231231
"The namespace must start with a character in the 'a-z' range, followed by characters in the 'a'-'z' or '0'-'9' ranges only.", 1140, STACK_TRACE_NOT_WANTED)
232232
GALASA_ERROR_FAILED_TO_COMPILE_PROPERTY_FIELD_REGEX = NewMessageType("GAL1141E: Unable to compile the regex pattern for Galasa Property field '%s'. Reason: '%s'", 1141, STACK_TRACE_NOT_WANTED)
233233
GALASA_ERROR_INVALID_PROPERTY_FIELD_FORMAT = NewMessageType("GAL1142E: The %s field value, '%s', provided does not match formatting requirements. "+
234-
"The %s field value must start with a character in the 'a-z' or 'A-Z' range, followed by any characters in the 'a'-'z', 'A'-'Z', '0'-'9', '.' (period), '-' (dash) or '_' (underscore) ranges only.", 1142, STACK_TRACE_NOT_WANTED)
234+
"The %s field value must start with a character in the 'a-z' or 'A-Z' range, followed by any characters in the 'a'-'z', 'A'-'Z', '0'-'9', '.' (period), '-' (dash) or '_' (underscore) or '@' (at) ranges only.", 1142, STACK_TRACE_NOT_WANTED)
235235
GALASA_ERROR_QUERY_RUNS_NON_OK_STATUS = NewMessageType("GAL1143E: Could not query run results. Server returned a non-200 code (%s)", 1143, STACK_TRACE_NOT_WANTED)
236236
GALASA_ERROR_GET_TEST_CATALOG_CONTENTS_FAILED = NewMessageType("GAL1144E: Could not use url '%s' to retrieve the contents of the test catalog from stream '%s'. Http error from the Galasa server is '%v'", 1144, STACK_TRACE_NOT_WANTED)
237237
GALASA_ERROR_FAILED_TO_CREATE_BEARER_TOKEN_FOLDER = NewMessageType("GAL1145E: Failed to create folder for bearer tokens at '%s'\n", 1145, STACK_TRACE_NOT_WANTED)

pkg/properties/properties.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
const (
1717
PROPERTY_NAMESPACE_PATTERN = "^[a-z][a-z0-9]+$"
18-
PROPERTY_NAME_PATTERN = "^[a-zA-Z][a-zA-Z0-9\\.\\-\\_]+$"
18+
PROPERTY_NAME_PATTERN = "^[a-zA-Z][a-zA-Z0-9\\.\\-\\_@]+$"
1919
)
2020

2121
func validateInputsAreNotEmpty(namespace string, name string) error {

pkg/properties/propertiesDelete_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ func TestDeletePropertyValueReturnsOk(t *testing.T) {
8585
assert.Nil(t, err)
8686
}
8787

88+
func TestDeletePropertyValueWithAtSymbolReturnsOk(t *testing.T) {
89+
//Given...
90+
namespace := "validnamespace"
91+
name := "Galasadelivery@ibm.com"
92+
93+
server := newDeletePropertiesServletMock(t)
94+
apiClient := api.InitialiseAPI(server.URL)
95+
defer server.Close()
96+
97+
//When
98+
err := DeleteProperty(namespace, name, apiClient)
99+
100+
//Then
101+
assert.Nil(t, err)
102+
}
103+
88104
// invalid OR empty namespace, valid propertyname
89105
func TestDeletePropertyWithInvalidNamesapceFormatReturnsError(t *testing.T) {
90106
//Given...

pkg/properties/propertiesSet_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,25 @@ func TestCreatePropertyWithValidNamespaceReturnsOk(t *testing.T) {
105105
assert.Nil(t, err)
106106
}
107107

108+
func TestCreatePropertyWithValidNamespaceWithAtSymbolReturnsOk(t *testing.T) {
109+
//Given...
110+
namespace := "validnamespace"
111+
name := "Galasadelivery@ibm.com"
112+
value := "someValue"
113+
114+
server := newSetPropertiesServletMock(t)
115+
apiServerUrl := server.URL
116+
defer server.Close()
117+
118+
apiClient := api.InitialiseAPI(apiServerUrl)
119+
120+
//When
121+
err := SetProperty(namespace, name, value, apiClient)
122+
123+
//Then
124+
assert.Nil(t, err)
125+
}
126+
108127
func TestUpdatePropertyWithInvalidNamespaceAndInvalidPropertyNameReturnsError(t *testing.T) {
109128
//Given...
110129
namespace := "invalidnamespace"
@@ -146,6 +165,25 @@ func TestUpdatePropertyWithValidNamespaceAndVaidNameValueReturnsOk(t *testing.T)
146165
assert.Nil(t, err)
147166
}
148167

168+
func TestUpdatePropertyWithValidNamespaceAndVaidNameValueWithAtSymbolReturnsOk(t *testing.T) {
169+
//Given...
170+
namespace := "validnamespace"
171+
name := "Galasadelivery@ibm.com"
172+
value := "updatedValue"
173+
174+
server := newSetPropertiesServletMock(t)
175+
apiServerUrl := server.URL
176+
defer server.Close()
177+
178+
apiClient := api.InitialiseAPI(apiServerUrl)
179+
180+
//When
181+
err := SetProperty(namespace, name, value, apiClient)
182+
183+
//Then
184+
assert.Nil(t, err)
185+
}
186+
149187
func TestUpdatePropertyWithInvalidNamespaceAndValidNameReturnsError(t *testing.T) {
150188
//Given...
151189
namespace := "invalidnamespace"

0 commit comments

Comments
 (0)