Skip to content

Commit

Permalink
test: Add two FAILING unit-tests for UnMarshallLimitNamespace (#167)
Browse files Browse the repository at this point in the history
The two failing test cases include:
- when namespace has no gateway name then return an error
- when namespace has no domain name then return an error

In these test-cases we leave the separator (either "/" or "#"), which causes the function to return an error when the gateway name or domain name is missing. In the last two test cases:
- when namespace only has gateway name (missing 'namespace/') and domain then return an error
- when namespace only has namespace name (missing '/gwName') and domain then return an error
the separator (/) is missing along with the namespace or gateway names, causing the function to return the correct error message.
  • Loading branch information
art-tapin committed May 9, 2023
1 parent 33584b8 commit 8b044ac
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkg/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,28 @@ func TestUnMarshallLimitNamespace(t *testing.T) {
expectedError: true,
},
{
name: "when namespace only has gateway name (missing 'namespace/') then return an error",
name: "when namespace has no gateway name then return an error",
namespace: "exampleNS/#domain.com",
expectedKey: client.ObjectKey{},
expectedDomain: "",
expectedError: true,
},
{
name: "when namespace has no domain name then return an error",
namespace: "exampleNS/exampleGW#",
expectedKey: client.ObjectKey{},
expectedDomain: "",
expectedError: true,
},
{
name: "when namespace only has gateway name (missing 'namespace/') and domain then return an error",
namespace: "exampleGW#domain.com",
expectedKey: client.ObjectKey{},
expectedDomain: "",
expectedError: true,
},
{
name: "when namespace only has namespace name (missing '/gwName') then return an error",
name: "when namespace only has namespace name (missing '/gwName') and domain then return an error",
namespace: "exampleNS#domain.com",
expectedKey: client.ObjectKey{},
expectedDomain: "",
Expand Down

0 comments on commit 8b044ac

Please sign in to comment.