-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass --volume options to creator phase #675
Changes from 3 commits
3ebcac1
7176afe
1f10e08
a52dbcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
fakePhase := &fakes.FakePhase{} | ||
fakePhaseFactory := fakes.NewFakePhaseFactory(fakes.WhichReturnsForNew(fakePhase)) | ||
|
||
err := lifecycle.Create(context.Background(), false, false, "test", "test", "test", "test", "test", fakePhaseFactory) | ||
err := lifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
h.AssertEq(t, fakePhase.CleanupCallCount, 1) | ||
|
@@ -70,7 +81,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
expectedRepoName := "some-repo-name" | ||
expectedRunImage := "some-run-image" | ||
|
||
err := verboseLifecycle.Create(context.Background(), false, false, expectedRunImage, "test", "test", expectedRepoName, "test", fakePhaseFactory) | ||
err := verboseLifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
expectedRunImage, | ||
"test", | ||
"test", | ||
expectedRepoName, | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -88,19 +110,65 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
expectedNetworkMode := "some-network-mode" | ||
|
||
err := lifecycle.Create(context.Background(), false, false, "test", "test", "test", "test", expectedNetworkMode, fakePhaseFactory) | ||
err := lifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
expectedNetworkMode, | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
h.AssertEq(t, configProvider.HostConfig().NetworkMode, container.NetworkMode(expectedNetworkMode)) | ||
}) | ||
|
||
it("configures the phase with both cache binds and custom volume mounts", func() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you added this check, maybe we can remove the tests on lines 212 and 332 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They still test slightly different circumstances - the difference between publish and not, as well as ensuring the cache binds will be configured regardless of whether a custom volume is configured. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right but I'm not sure if I would keep all 3 tests. I think it's a little confusing that we're testing part of it 3 times. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I opted to remove this test, and add custom volume mounts to the existing bind tests which cover both the |
||
lifecycle := newTestLifecycle(t, false) | ||
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
expectedBind := "some-mount-source:/some-mount-target" | ||
expectedBinds := []string{expectedBind, "some-cache:/cache", "some-launch-cache:/launch-cache"} | ||
|
||
err := lifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
"test", | ||
"some-launch-cache", | ||
"some-cache", | ||
"test", | ||
"test", | ||
[]string{expectedBind}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
h.AssertSliceContains(t, configProvider.HostConfig().Binds, expectedBinds...) | ||
}) | ||
|
||
when("clear cache", func() { | ||
it("configures the phase with the expected arguments", func() { | ||
verboseLifecycle := newTestLifecycle(t, true) | ||
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
|
||
err := verboseLifecycle.Create(context.Background(), false, true, "test", "test", "test", "test", "test", fakePhaseFactory) | ||
err := verboseLifecycle.Create( | ||
context.Background(), | ||
false, | ||
true, | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -117,7 +185,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
verboseLifecycle := newTestLifecycle(t, true) | ||
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
|
||
err := verboseLifecycle.Create(context.Background(), false, false, "test", "test", "test", "test", "test", fakePhaseFactory) | ||
err := verboseLifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -135,7 +214,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
expectedBinds := []string{"some-cache:/cache"} | ||
|
||
err := lifecycle.Create(context.Background(), true, false, "test", "test", "some-cache", "test", "test", fakePhaseFactory) | ||
err := lifecycle.Create( | ||
context.Background(), | ||
true, | ||
false, | ||
"test", | ||
"test", | ||
"some-cache", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -146,7 +236,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
lifecycle := newTestLifecycle(t, false) | ||
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
|
||
err := lifecycle.Create(context.Background(), true, false, "test", "test", "test", "test", "test", fakePhaseFactory) | ||
err := lifecycle.Create( | ||
context.Background(), | ||
true, | ||
false, | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -158,7 +259,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
expectedRepos := "some-repo-name" | ||
|
||
err := lifecycle.Create(context.Background(), true, false, "test", "test", "test", expectedRepos, "test", fakePhaseFactory) | ||
err := lifecycle.Create( | ||
context.Background(), | ||
true, | ||
false, | ||
"test", | ||
"test", | ||
"test", | ||
expectedRepos, | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -171,7 +283,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
verboseLifecycle := newTestLifecycle(t, true) | ||
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
|
||
err := verboseLifecycle.Create(context.Background(), false, false, "test", "test", "test", "test", "test", fakePhaseFactory) | ||
err := verboseLifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -187,7 +310,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
lifecycle := newTestLifecycle(t, false) | ||
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
|
||
err := lifecycle.Create(context.Background(), false, false, "test", "some-launch-cache", "some-cache", "test", "test", fakePhaseFactory) | ||
err := lifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
"test", | ||
"some-launch-cache", | ||
"some-cache", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
@@ -200,7 +334,18 @@ func testPhases(t *testing.T, when spec.G, it spec.S) { | |
fakePhaseFactory := fakes.NewFakePhaseFactory() | ||
expectedBinds := []string{"some-cache:/cache", "some-launch-cache:/launch-cache"} | ||
|
||
err := lifecycle.Create(context.Background(), false, false, "test", "some-launch-cache", "some-cache", "test", "test", fakePhaseFactory) | ||
err := lifecycle.Create( | ||
context.Background(), | ||
false, | ||
false, | ||
"test", | ||
"some-launch-cache", | ||
"some-cache", | ||
"test", | ||
"test", | ||
[]string{}, | ||
fakePhaseFactory, | ||
) | ||
h.AssertNil(t, err) | ||
|
||
configProvider := fakePhaseFactory.NewCalledWithProvider | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the assertions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is now skippable, so cleanup can reasonably expect to fail when it's skipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! Thanks for the clarification!