github.phpd.cn/cilium/cilium@v1.6.12/test/runtime/privileged_tests.go (about)

     1  // Copyright 2019 Authors of Cilium
     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 RuntimeTest
    16  
    17  import (
    18  	"fmt"
    19  
    20  	. "github.com/cilium/cilium/test/ginkgo-ext"
    21  	"github.com/cilium/cilium/test/helpers"
    22  
    23  	. "github.com/onsi/gomega"
    24  )
    25  
    26  var _ = Describe("RuntimePrivilegedUnitTests", func() {
    27  
    28  	var vm *helpers.SSHMeta
    29  
    30  	BeforeAll(func() {
    31  		vm = helpers.InitRuntimeHelper(helpers.Runtime, logger)
    32  		res := vm.ExecWithSudo("systemctl stop cilium")
    33  		res.ExpectSuccess("Failed trying to stop cilium via systemctl")
    34  		ExpectCiliumNotRunning(vm)
    35  	})
    36  
    37  	AfterAll(func() {
    38  		err := vm.RestartCilium()
    39  		Expect(err).Should(BeNil(), "Failed to restart Cilium")
    40  		vm.CloseSSHClient()
    41  	})
    42  
    43  	It("Run Tests", func() {
    44  		res := vm.ExecWithSudo(fmt.Sprintf("make -C %s tests-privileged", helpers.CiliumBasePath))
    45  		res.ExpectSuccess("Failed to run privileged unit tests")
    46  	})
    47  })