-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add skeleton for minikube image integration test
- Loading branch information
1 parent
943561b
commit a267c60
Showing
4 changed files
with
74 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// +build integration | ||
|
||
/* | ||
Copyright 2021 The Kubernetes Authors All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package integration | ||
|
||
import ( | ||
"context" | ||
"os/exec" | ||
"path/filepath" | ||
"testing" | ||
) | ||
|
||
// TestImage tests minikube image | ||
func TestImage(t *testing.T) { | ||
profile := UniqueProfileName("image") | ||
ctx, cancel := context.WithTimeout(context.Background(), Minutes(5)) | ||
defer CleanupWithLogs(t, profile, cancel) | ||
|
||
args := append([]string{"start", "-p", profile, "--memory=2048"}, StartArgs()...) | ||
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) | ||
if err != nil { | ||
t.Fatalf("starting minikube: %v\n%s", err, rr.Output()) | ||
} | ||
|
||
tests := []struct { | ||
command string | ||
args []string | ||
}{ | ||
{ | ||
command: "image", | ||
args: []string{"load", filepath.Join(*testdataDir, "hello-world.tar")}, | ||
}, { | ||
command: "image", | ||
args: []string{"list"}, | ||
}, { | ||
command: "image", | ||
args: []string{"rm", "hello-world"}, | ||
}, { | ||
command: "image", | ||
args: []string{"build", filepath.Join(*testdataDir, "build")}, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
t.Run(test.command, func(t *testing.T) { | ||
args := []string{test.command, "-p", profile} | ||
args = append(args, test.args...) | ||
|
||
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) | ||
if err != nil { | ||
t.Errorf("failed to clean up: args %q: %v", rr.Command(), err) | ||
} | ||
}) | ||
} | ||
} |
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,3 @@ | ||
FROM busybox | ||
RUN true | ||
ADD content.txt |
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 @@ | ||
Content for image build |
Binary file not shown.