forked from redboxllc/scuttle
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove outdated kill method to stop sidecar
- Loading branch information
Showing
4 changed files
with
74 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,51 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func Test_replacePort(t *testing.T) { | ||
type args struct { | ||
sourceURL string | ||
original int | ||
replacement int | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
name: "Happy flow", | ||
args: args{ | ||
sourceURL: "http://localhost:15000", | ||
original: 15000, | ||
replacement: 15020, | ||
}, | ||
want: "http://localhost:15020", | ||
}, | ||
{ | ||
name: "Invalid URL", | ||
args: args{ | ||
sourceURL: "notaurl^^ :15000", | ||
original: 15000, | ||
replacement: 15020, | ||
}, | ||
want: "", | ||
}, | ||
{ | ||
name: "Port not matching", | ||
args: args{ | ||
sourceURL: "http://localhost:14000", | ||
original: 15000, | ||
replacement: 15020, | ||
}, | ||
want: "", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := replacePort(tt.args.sourceURL, tt.args.original, tt.args.replacement); got != tt.want { | ||
t.Errorf("replacePort() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |