summaryrefslogtreecommitdiffhomepage
path: root/test/image
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2020-06-17 18:41:55 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-17 18:43:26 -0700
commit97f6b20e89d99c4d92d6491ef3fad0933c9ba53d (patch)
tree882af70a9f52ae1eefef23ed48014e09f160abd3 /test/image
parent57286eb642b9becc566f8e9c1dcbe24619f7772b (diff)
Move mount configutation to RunOpts
Separate mount configuration from links and move it to RunOpts, like the other options. PiperOrigin-RevId: 317010158
Diffstat (limited to 'test/image')
-rw-r--r--test/image/image_test.go35
1 files changed, 22 insertions, 13 deletions
diff --git a/test/image/image_test.go b/test/image/image_test.go
index 2e3543109..3e4321480 100644
--- a/test/image/image_test.go
+++ b/test/image/image_test.go
@@ -111,11 +111,12 @@ func TestHttpd(t *testing.T) {
defer d.CleanUp()
// Start the container.
- d.CopyFiles("/usr/local/apache2/htdocs", "test/image/latin10k.txt")
- if err := d.Spawn(dockerutil.RunOpts{
+ opts := dockerutil.RunOpts{
Image: "basic/httpd",
Ports: []int{80},
- }); err != nil {
+ }
+ d.CopyFiles(&opts, "/usr/local/apache2/htdocs", "test/image/latin10k.txt")
+ if err := d.Spawn(opts); err != nil {
t.Fatalf("docker run failed: %v", err)
}
@@ -138,11 +139,12 @@ func TestNginx(t *testing.T) {
defer d.CleanUp()
// Start the container.
- d.CopyFiles("/usr/share/nginx/html", "test/image/latin10k.txt")
- if err := d.Spawn(dockerutil.RunOpts{
+ opts := dockerutil.RunOpts{
Image: "basic/nginx",
Ports: []int{80},
- }); err != nil {
+ }
+ d.CopyFiles(&opts, "/usr/share/nginx/html", "test/image/latin10k.txt")
+ if err := d.Spawn(opts); err != nil {
t.Fatalf("docker run failed: %v", err)
}
@@ -183,11 +185,17 @@ func TestMysql(t *testing.T) {
// Tell mysql client to connect to the server and execute the file in
// verbose mode to verify the output.
- client.CopyFiles("/sql", "test/image/mysql.sql")
- client.Link("mysql", server)
- if _, err := client.Run(dockerutil.RunOpts{
+ opts := dockerutil.RunOpts{
Image: "basic/mysql",
- }, "mysql", "-hmysql", "-uroot", "-pfoobar123", "-v", "-e", "source /sql/mysql.sql"); err != nil {
+ Links: []dockerutil.Link{
+ {
+ Source: server,
+ Target: "mysql",
+ },
+ },
+ }
+ client.CopyFiles(&opts, "/sql", "test/image/mysql.sql")
+ if _, err := client.Run(opts, "mysql", "-hmysql", "-uroot", "-pfoobar123", "-v", "-e", "source /sql/mysql.sql"); err != nil {
t.Fatalf("docker run failed: %v", err)
}
@@ -236,11 +244,12 @@ func TestRuby(t *testing.T) {
defer d.CleanUp()
// Execute the ruby workload.
- d.CopyFiles("/src", "test/image/ruby.rb", "test/image/ruby.sh")
- if err := d.Spawn(dockerutil.RunOpts{
+ opts := dockerutil.RunOpts{
Image: "basic/ruby",
Ports: []int{8080},
- }, "/src/ruby.sh"); err != nil {
+ }
+ d.CopyFiles(&opts, "/src", "test/image/ruby.rb", "test/image/ruby.sh")
+ if err := d.Spawn(opts, "/src/ruby.sh"); err != nil {
t.Fatalf("docker run failed: %v", err)
}