github.com/lfch/etcd-io/tests/v3@v3.0.0-20221004140520-eac99acd3e9d/framework/e2e/flags.go (about)

     1  // Copyright 2021 The etcd Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package e2e
    16  
    17  import (
    18  	"flag"
    19  	"os"
    20  	"runtime"
    21  
    22  	"github.com/lfch/etcd-io/tests/v3/framework/integration"
    23  )
    24  
    25  var (
    26  	BinDir  string
    27  	CertDir string
    28  
    29  	CertPath       string
    30  	PrivateKeyPath string
    31  	CaPath         string
    32  
    33  	CertPath2       string
    34  	PrivateKeyPath2 string
    35  
    36  	CertPath3       string
    37  	PrivateKeyPath3 string
    38  
    39  	CrlPath               string
    40  	RevokedCertPath       string
    41  	RevokedPrivateKeyPath string
    42  
    43  	FixturesDir = integration.MustAbsPath("../fixtures")
    44  )
    45  
    46  func InitFlags() {
    47  	os.Setenv("ETCD_UNSUPPORTED_ARCH", runtime.GOARCH)
    48  	os.Unsetenv("ETCDCTL_API")
    49  
    50  	binDirDef := integration.MustAbsPath("../../bin")
    51  	certDirDef := FixturesDir
    52  
    53  	flag.StringVar(&BinDir, "bin-dir", binDirDef, "The directory for store etcd and etcdctl binaries.")
    54  	flag.StringVar(&CertDir, "cert-dir", certDirDef, "The directory for store certificate files.")
    55  	flag.Parse()
    56  
    57  	BinPath = BinDir + "/etcd"
    58  	CtlBinPath = BinDir + "/etcdctl"
    59  	UtlBinPath = BinDir + "/etcdutl"
    60  	CertPath = CertDir + "/server.crt"
    61  	PrivateKeyPath = CertDir + "/server.key.insecure"
    62  	CaPath = CertDir + "/ca.crt"
    63  	RevokedCertPath = CertDir + "/server-revoked.crt"
    64  	RevokedPrivateKeyPath = CertDir + "/server-revoked.key.insecure"
    65  	CrlPath = CertDir + "/revoke.crl"
    66  
    67  	CertPath2 = CertDir + "/server2.crt"
    68  	PrivateKeyPath2 = CertDir + "/server2.key.insecure"
    69  
    70  	CertPath3 = CertDir + "/server3.crt"
    71  	PrivateKeyPath3 = CertDir + "/server3.key.insecure"
    72  }