This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handling usr:pwd@url during service linking
- Loading branch information
Marcel Ludwig
committed
Feb 9, 2018
1 parent
c3b0b79
commit 7a4fdb5
Showing
3 changed files
with
67 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,51 @@ func TestLinker_Resolve(t *testing.T) { | |
|
||
} | ||
|
||
func TestLinker_ResolveUsrPwd(t *testing.T) { | ||
linker := &converter.Linker{} | ||
name := "sloppy-test" | ||
|
||
expected := &converter.SloppyFile{ | ||
Version: "v1", | ||
Project: name, | ||
Services: map[string]converter.SloppyApps{ | ||
"apps": { | ||
"a": &converter.SloppyApp{ | ||
App: &sloppy.App{ | ||
Dependencies: []string{"../apps/b"}, | ||
EnvVars: map[string]string{ | ||
"API_AUTH": fmt.Sprintf("https://admin:[email protected].%s:443", name), | ||
"API_URL": fmt.Sprintf("b.apps.%s:443", name), | ||
}, | ||
Image: ToStrPtr("hugo"), | ||
}, | ||
Env: converter.SloppyEnvSlice{ | ||
{"API_AUTH": fmt.Sprintf("https://admin:[email protected].%s:443", name)}, | ||
{"API_URL": fmt.Sprintf("b.apps.%s:443", name)}, | ||
}, | ||
}, | ||
"b": &converter.SloppyApp{ | ||
App: &sloppy.App{ | ||
Image: ToStrPtr("go:rulez"), | ||
}, | ||
Port: ToIntPtr(4443), | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
cf, sf := loadSloppyFile("/testdata/fixture_linker1.yml") | ||
err := linker.Resolve(cf, sf) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if diff := cmp.Diff(sf, expected); diff != "" { | ||
t.Errorf("Result differs: (-got +want)\n%s", diff) | ||
} | ||
|
||
} | ||
|
||
func ToIntPtr(i int) *int { | ||
return &i | ||
} | ||
|
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,13 @@ | ||
version: "2" | ||
|
||
services: | ||
a: | ||
image: hugo | ||
environment: | ||
- API_URL=b:443 | ||
# even if this is not a html standard and are not supported by any major browser | ||
- API_AUTH=https://admin:pass@b:443 | ||
b: | ||
image: go:rulez | ||
ports: | ||
- 443:4443 |