This repository was archived by the owner on Aug 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Go add some network policies… #134
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b344a83
feat(cfd): WIP adding network policy creation support
zjrgov c8a4330
feat(cfd): parse port ranges for addNetworkPolicy
zjrgov 42dd18b
tests(cfd): unit test parsePortRange
zjrgov e97611f
fix(cfd): check if end port nil
zjrgov a47b353
fix(cfd): addNetworkPolicy interface signature updated
zjrgov 18d83fc
tests(cfd): network policy integration testing
zjrgov ac608fd
style(cfd): staticcheck fixes
zjrgov 994c654
chore(cfd): update go.sum
zjrgov 27aaa26
tests(cfd): unit test missing correct arg val
zjrgov 0505709
tests(cfd): update AppGet integration for second test app
zjrgov bea2244
refactor(cfd): loop netpolicy regex test
zjrgov dcd0bac
Update runner-manager/cfd/cloudgov/cf_client_test.go
zjrgov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package cloudgov | ||
|
|
||
| import "testing" | ||
|
|
||
| func Test_parsePortRange(t *testing.T) { | ||
| tests := []struct { | ||
| name string // description of this test case | ||
| // Named input parameters for target function. | ||
| prange string | ||
| want int | ||
| want2 int | ||
| wantErr bool | ||
| }{ | ||
| {name: "parses a range", prange: "80-85", want: 80, want2: 85}, | ||
| {name: "parses redundant range", prange: "81-81", want: 81, want2: 81}, | ||
| {name: "parses single port", prange: "80", want: 80, want2: 80}, | ||
| {name: "parses single number with separator", prange: "8-", want: 8, want2: 8}, | ||
| {name: "parses zero", prange: "0", want: 0, want2: 0}, | ||
| {name: "fails to parse range with non-int", prange: "60-cat", wantErr: true}, | ||
| {name: "fails to parse single with non-int", prange: "cat", wantErr: true}, | ||
| {name: "fails with empty string", prange: "", wantErr: true}, | ||
| {name: "fails with only separator", prange: "-", wantErr: true}, | ||
| } | ||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| got, got2, gotErr := parsePortRange(tt.prange) | ||
| if gotErr != nil { | ||
| if !tt.wantErr { | ||
| t.Errorf("parsePortRange() failed: %v", gotErr) | ||
| } | ||
| return | ||
| } | ||
| if tt.wantErr { | ||
| t.Fatal("parsePortRange() succeeded unexpectedly") | ||
| } | ||
| if got != tt.want { | ||
| t.Errorf("parsePortRange() = %v, want %v", got, tt.want) | ||
| } | ||
| if got2 != tt.want2 { | ||
| t.Errorf("parsePortRange() = %v, want %v", got2, tt.want2) | ||
| } | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.