提交 de4b9b65 编写于 作者: T tstromberg

Add offline integration test

上级 04486049
// +build integration
/*
Copyright 2016 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"
"fmt"
"os"
"os/exec"
"testing"
"time"
)
func TestOffline(t *testing.T) {
MaybeParallel(t)
t.Run("group", func(t *testing.T) {
for _, runtime := range []string{"docker", "crio", "containerd"} {
t.Run(runtime, func(t *testing.T) {
MaybeParallel(t)
WaitForStartSlot(t)
if runtime != "docker" && NoneDriver() {
t.Skipf("skipping %s - incompatible with none driver", t.Name())
}
profile := UniqueProfileName(fmt.Sprintf("offline-%s", runtime))
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
defer CleanupWithLogs(t, profile, cancel)
startArgs := append([]string{"start", "-p", profile, "--alsologtostderr", "-v=1", "--wait=true", "--container-runtime", runtime})
c := exec.CommandContext(ctx, Target(), startArgs...)
env := os.Environ()
env = append(env, "HTTP_PROXYS=172.1.1.1")
env = append(env, "DOCKER_HOST=172.1.1.1")
rr, err := Run(t, c)
if err != nil {
// Fatal so that we may collect logs before stop/delete steps
t.Fatalf("%s failed: %v", rr.Args, err)
}
})
}
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册