Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nkubala committed Mar 6, 2019
1 parent 22d8784 commit 1cabc1f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
10 changes: 10 additions & 0 deletions docs/content/en/docs/references/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Flags:
--enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev)
-f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml")
-n, --namespace string Run deployments in the specified namespace
--no-prune Skip removing images and containers built by Skaffold
-o, --output *flags.TemplateFlag Format output with go-template. For full struct documentation, see https://godoc.org/github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/cmd#BuildOutput (default {{range .Builds}}{{.ImageName}} -> {{.Tag}}
{{end}})
-p, --profile stringArray Activate profiles by name
Expand All @@ -93,6 +94,7 @@ Env vars:
* `SKAFFOLD_ENABLE_RPC` (same as --enable-rpc)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_NO_PRUNE` (same as --no-prune)
* `SKAFFOLD_OUTPUT` (same as --output)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_QUIET` (same as --quiet)
Expand Down Expand Up @@ -156,6 +158,7 @@ Flags:
--enable-rpc skaffold dev Enable gRPC for exposing Skaffold events (true by default for skaffold dev)
-f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml")
-n, --namespace string Run deployments in the specified namespace
--no-prune Skip removing images and containers built by Skaffold
-p, --profile stringArray Activate profiles by name
--rpc-port string tcp port to expose event API (default ":50051")
--skip-tests Whether to skip the tests after building
Expand All @@ -175,6 +178,7 @@ Env vars:
* `SKAFFOLD_ENABLE_RPC` (same as --enable-rpc)
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_NO_PRUNE` (same as --no-prune)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
Expand All @@ -197,6 +201,7 @@ Flags:
--images strings A list of pre-built images to deploy
-l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels.
-n, --namespace string Run deployments in the specified namespace
--no-prune Skip removing images and containers built by Skaffold
-p, --profile stringArray Activate profiles by name
--rpc-port string tcp port to expose event API (default ":50051")
--skip-tests Whether to skip the tests after building
Expand All @@ -219,6 +224,7 @@ Env vars:
* `SKAFFOLD_IMAGES` (same as --images)
* `SKAFFOLD_LABEL` (same as --label)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_NO_PRUNE` (same as --no-prune)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
Expand All @@ -243,6 +249,7 @@ Flags:
-f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml")
-l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels
-n, --namespace string Run deployments in the specified namespace
--no-prune Skip removing images and containers built by Skaffold
--port-forward Port-forward exposed container ports within pods (default true)
-p, --profile stringArray Activate profiles by name
--rpc-port string tcp port to expose event API (default ":50051")
Expand Down Expand Up @@ -270,6 +277,7 @@ Env vars:
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_LABEL` (same as --label)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_NO_PRUNE` (same as --no-prune)
* `SKAFFOLD_PORT_FORWARD` (same as --port-forward)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
Expand Down Expand Up @@ -374,6 +382,7 @@ Flags:
-f, --filename string Filename or URL to the pipeline file (default "skaffold.yaml")
-l, --label stringArray Add custom labels to deployed objects. Set multiple times for multiple labels.
-n, --namespace string Run deployments in the specified namespace
--no-prune Skip removing images and containers built by Skaffold
-p, --profile stringArray Activate profiles by name
--rpc-port string tcp port to expose event API (default ":50051")
--skip-tests Whether to skip the tests after building
Expand All @@ -396,6 +405,7 @@ Env vars:
* `SKAFFOLD_FILENAME` (same as --filename)
* `SKAFFOLD_LABEL` (same as --label)
* `SKAFFOLD_NAMESPACE` (same as --namespace)
* `SKAFFOLD_NO_PRUNE` (same as --no-prune)
* `SKAFFOLD_PROFILE` (same as --profile)
* `SKAFFOLD_RPC_PORT` (same as --rpc-port)
* `SKAFFOLD_SKIP_TESTS` (same as --skip-tests)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/build/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (c *Cache) RetrieveCachedArtifacts(ctx context.Context, out io.Writer, arti
artifact, err := c.resolveCachedArtifact(ctx, out, a)
if err != nil {
logrus.Debugf("error retrieving cached artifact for %s: %v\n", a.ImageName, err)
color.Red.Fprintln(out, "Unable to retrieve %s from cache; this image will be rebuilt.", a.ImageName)
color.Red.Fprintf(out, "Unable to retrieve %s from cache; this image will be rebuilt.\n", a.ImageName)
needToBuild = append(needToBuild, a)
continue
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/build/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func Test_RetrieveCachedArtifacts(t *testing.T) {
localCluster = originalLocal
}()

test.cache.client = docker.NewLocalDaemon(&test.api, nil)
test.cache.client = docker.NewLocalDaemon(&test.api, nil, false)

actualArtifacts, actualBuildResults := test.cache.RetrieveCachedArtifacts(context.Background(), os.Stdout, test.artifacts)
testutil.CheckErrorAndDeepEqual(t, false, nil, test.expectedArtifacts, actualArtifacts)
Expand Down Expand Up @@ -406,7 +406,7 @@ func TestRetrieveCachedArtifactDetails(t *testing.T) {
remoteDigest = originalRemoteDigest
}()

test.cache.client = docker.NewLocalDaemon(&test.api, nil)
test.cache.client = docker.NewLocalDaemon(&test.api, nil, false)
actual, err := test.cache.retrieveCachedArtifactDetails(context.Background(), test.artifact)
if err != nil {
t.Fatalf("error retrieving artifact details: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/build/local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func TestLocalRun(t *testing.T) {
event.InitializeState(cfg, nil, &config.SkaffoldOptions{})
l := Builder{
cfg: &latest.LocalBuild{},
localDocker: docker.NewLocalDaemon(&test.api, nil),
localDocker: docker.NewLocalDaemon(&test.api, nil, false),
pushImages: test.pushImages,
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/skaffold/build/plugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func (b *mockBuilder) DependenciesForArtifact(ctx context.Context, artifact *lat
return nil, nil
}

func (b *mockBuilder) Prune(ctx context.Context, out io.Writer) error {
return nil
}

func TestPluginBuilderLabels(t *testing.T) {
tests := []struct {
name string
Expand Down
2 changes: 1 addition & 1 deletion pkg/skaffold/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ type SkaffoldRunner struct {
builds []build.Artifact
hasDeployed bool
needsPush bool
hasBuilt bool
imageList *kubernetes.ImageList
namespaces []string
RPCServerShutdown func() error
hasBuilt bool
}

// NewForConfig returns a new SkaffoldRunner for a SkaffoldPipeline
Expand Down
3 changes: 3 additions & 0 deletions pkg/skaffold/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (t *TestBench) Labels() map[string]string { return m
func (t *TestBench) TestDependencies() ([]string, error) { return nil, nil }
func (t *TestBench) Dependencies() ([]string, error) { return nil, nil }
func (t *TestBench) Cleanup(ctx context.Context, out io.Writer) error { return nil }
func (t *TestBench) Prune(ctx context.Context, out io.Writer) error { return nil }
func (t *TestBench) DependenciesForArtifact(ctx context.Context, artifact *latest.Artifact) ([]string, error) {
return nil, nil
}
Expand Down Expand Up @@ -96,6 +97,8 @@ func (t *TestBench) Sync(ctx context.Context, item *sync.Item) error {
if len(t.syncErrors) > 0 {
err := t.syncErrors[0]
t.syncErrors = t.syncErrors[1:]
if err != nil {
return err
}
}

Expand Down

0 comments on commit 1cabc1f

Please sign in to comment.