go.ligato.io/vpp-agent/v3@v3.5.0/tests/integration/vpp/main_test.go (about)

     1  //  Copyright (c) 2019 Cisco and/or its affiliates.
     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 vpp
    16  
    17  import (
    18  	"flag"
    19  	"log"
    20  	"os"
    21  	"testing"
    22  
    23  	"github.com/sirupsen/logrus"
    24  	govppcore "go.fd.io/govpp/core"
    25  
    26  	testutils "go.ligato.io/vpp-agent/v3/tests/testutils"
    27  )
    28  
    29  var (
    30  	vppPath     = flag.String("vpp-path", "/usr/bin/vpp", "VPP program path")
    31  	vppConfig   = flag.String("vpp-config", "", "VPP config file")
    32  	vppSockAddr = flag.String("vpp-sock-addr", "/run/vpp/api.sock", "VPP binapi socket address")
    33  	vppRetry    = flag.Uint("retry", 3, "Number of VPP connect retries")
    34  
    35  	debug = flag.Bool("debug", false, "Turn on debug mode.")
    36  )
    37  
    38  func TestMain(m *testing.M) {
    39  	log.SetFlags(log.Lmicroseconds | log.Lshortfile)
    40  	flag.Parse()
    41  	if *debug {
    42  		govppcore.SetLogLevel(logrus.DebugLevel)
    43  	}
    44  	if testutils.RunTestSuite("integration") {
    45  		result := m.Run()
    46  		os.Exit(result)
    47  	}
    48  }