"Fossies" - the Fresh Open Source Software Archive

Member "minikube-1.26.1/test/integration/aab_offline_test.go" (2 Aug 2022, 1944 Bytes) of package /linux/misc/minikube-1.26.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Go source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "aab_offline_test.go": 1.25.2_vs_1.26.0.

    1 //go:build integration
    2 
    3 /*
    4 Copyright 2016 The Kubernetes Authors All rights reserved.
    5 
    6 Licensed under the Apache License, Version 2.0 (the "License");
    7 you may not use this file except in compliance with the License.
    8 You may obtain a copy of the License at
    9 
   10     http://www.apache.org/licenses/LICENSE-2.0
   11 
   12 Unless required by applicable law or agreed to in writing, software
   13 distributed under the License is distributed on an "AS IS" BASIS,
   14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15 See the License for the specific language governing permissions and
   16 limitations under the License.
   17 */
   18 
   19 package integration
   20 
   21 import (
   22     "context"
   23     "fmt"
   24     "os"
   25     "os/exec"
   26     "testing"
   27 )
   28 
   29 // TestOffline makes sure minikube works without internet, once the user has cached the necessary images.
   30 // This test has to run after TestDownloadOnly.
   31 func TestOffline(t *testing.T) {
   32     MaybeParallel(t)
   33     rt := ContainerRuntime()
   34     if rt != "docker" && arm64Platform() {
   35         t.Skipf("skipping %s - only docker runtime supported on arm64. See https://github.com/kubernetes/minikube/issues/10144", t.Name())
   36     }
   37 
   38     if rt != "docker" && NoneDriver() {
   39         t.Skipf("skipping %s - incompatible with none driver", t.Name())
   40     }
   41 
   42     profile := UniqueProfileName(fmt.Sprintf("offline-%s", rt))
   43     ctx, cancel := context.WithTimeout(context.Background(), Minutes(15))
   44     defer CleanupWithLogs(t, profile, cancel)
   45 
   46     startArgs := []string{"start", "-p", profile, "--alsologtostderr", "-v=1", "--memory=2048", "--wait=true"}
   47     startArgs = append(startArgs, StartArgs()...)
   48     c := exec.CommandContext(ctx, Target(), startArgs...)
   49     env := os.Environ()
   50     // RFC1918 address that unlikely to host working a proxy server
   51     env = append(env, "HTTP_PROXY=172.16.1.1:1")
   52     env = append(env, "HTTP_PROXYS=172.16.1.1:1")
   53 
   54     c.Env = env
   55     rr, err := Run(t, c)
   56     if err != nil {
   57         // Fatal so that we may collect logs before stop/delete steps
   58         t.Fatalf("%s failed: %v", rr.Command(), err)
   59     }
   60 }