|
|
@ -17,7 +17,9 @@ limitations under the License.
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"io"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"regexp"
|
|
|
|
"regexp"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
@ -431,6 +433,25 @@ func TestInstallReleaseNoHooks(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestInstallReleaseFailedHooks(t *testing.T) {
|
|
|
|
|
|
|
|
c := context.Background()
|
|
|
|
|
|
|
|
rs := rsFixture()
|
|
|
|
|
|
|
|
rs.env.Releases.Create(releaseStub())
|
|
|
|
|
|
|
|
rs.env.KubeClient = newHookFailingKubeClient()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
req := &services.InstallReleaseRequest{
|
|
|
|
|
|
|
|
Chart: chartStub(),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
res, err := rs.InstallRelease(c, req)
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
|
|
|
|
t.Error("Expected failed install")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if hl := res.Release.Info.Status.Code; hl != release.Status_FAILED {
|
|
|
|
|
|
|
|
t.Errorf("Expected FAILED release. Got %d", hl)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestInstallReleaseReuseName(t *testing.T) {
|
|
|
|
func TestInstallReleaseReuseName(t *testing.T) {
|
|
|
|
c := context.Background()
|
|
|
|
c := context.Background()
|
|
|
|
rs := rsFixture()
|
|
|
|
rs := rsFixture()
|
|
|
@ -912,6 +933,20 @@ func mockEnvironment() *environment.Environment {
|
|
|
|
return e
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func newHookFailingKubeClient() *hookFailingKubeClient {
|
|
|
|
|
|
|
|
return &hookFailingKubeClient{
|
|
|
|
|
|
|
|
PrintingKubeClient: environment.PrintingKubeClient{Out: os.Stdout},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type hookFailingKubeClient struct {
|
|
|
|
|
|
|
|
environment.PrintingKubeClient
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (h *hookFailingKubeClient) WatchUntilReady(ns string, r io.Reader) error {
|
|
|
|
|
|
|
|
return errors.New("Failed watch")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type mockListServer struct {
|
|
|
|
type mockListServer struct {
|
|
|
|
val *services.ListReleasesResponse
|
|
|
|
val *services.ListReleasesResponse
|
|
|
|
}
|
|
|
|
}
|
|
|
|