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

     1  //  Copyright (c) 2021 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  	"testing"
    19  
    20  	. "github.com/onsi/gomega"
    21  
    22  	"go.ligato.io/vpp-agent/v3/plugins/govppmux/vppcalls"
    23  )
    24  
    25  func TestPing(t *testing.T) {
    26  	test := setupVPP(t)
    27  	defer test.teardownVPP()
    28  
    29  	vpp := vppcalls.CompatibleHandler(test.vppClient)
    30  
    31  	Expect(vpp.Ping(test.Ctx)).To(Succeed())
    32  
    33  	session, err := vpp.GetSession(test.Ctx)
    34  	Expect(err).ToNot(HaveOccurred())
    35  	Expect(session.PID).To(BeEquivalentTo(test.vppCmd.Process.Pid))
    36  }
    37  
    38  func TestGetVersion(t *testing.T) {
    39  	test := setupVPP(t)
    40  	defer test.teardownVPP()
    41  
    42  	vpp := vppcalls.CompatibleHandler(test.vppClient)
    43  
    44  	info, err := vpp.GetVersion(test.Ctx)
    45  	Expect(err).ToNot(HaveOccurred())
    46  	Expect(info.Version).To(BePrintable(), "Version should be printable string:\n\t%#v", info)
    47  }
    48  
    49  func TestGetPlugins(t *testing.T) {
    50  	test := setupVPP(t)
    51  	defer test.teardownVPP()
    52  
    53  	vpp := vppcalls.CompatibleHandler(test.vppClient)
    54  
    55  	plugins, err := vpp.GetPlugins(test.Ctx)
    56  	Expect(err).ToNot(HaveOccurred())
    57  	t.Logf("%d plugins: %v", len(plugins), plugins)
    58  	Expect(plugins).ToNot(BeEmpty())
    59  
    60  	// GetModules seems to be returning nothing since VPP 22.02
    61  	/*modules, err := vpp.GetModules(test.Ctx)
    62  	  Expect(err).ToNot(HaveOccurred())
    63  	  t.Logf("%d modules: %v", len(modules), modules)
    64  	  Expect(modules).ToNot(BeEmpty())*/
    65  }