Debian Codegraph @

tests/nftlib/nftlib_test.go

raw symbols SCIP
1 //go:build !exec
2 // +build !exec
3
4 /* This file is part of the go-nft project
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 * Copyright 2021 Red Hat, Inc.
19 *
20 */
21 package mainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/tests/nftlib`/
22
23 import (
24 "testingscip-go gomod github.com/golang/go/src go1.16 testing/"
25
26 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/ "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/"
27
28 "github.com/networkplumbing/go-nft/nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/"
29 nftlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/ "github.com/networkplumbing/go-nft/nft/libscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/"
30
31 "github.com/networkplumbing/go-nft/tests/testlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/tests/testlib`/"
32 )
33
34 func TestNftlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/tests/nftlib`/TestNftlib().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
35 testlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/tests/testlib`/.RunTestWithFlushTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/tests/testlib`/RunTestWithFlushTable().(t, func(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
36 config := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewConfigscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewConfig().()
37 config.AddTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#AddTable().(nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewTable().("mytable", nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.FamilyIPscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/FamilyIP.))
38
39 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/NoError().(t, nftlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/.ApplyConfigscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/ApplyConfig().(config))
40
41 newConfig, err := nftlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/.ReadConfigscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/ReadConfig().()
42 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/NoError().(t, err)
43
44 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.Lenscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/Len().(t, newConfig.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables., 2, "Expecting the metainfo and an empty table entry")
45 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/Equal().(t, config.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables.[0], newConfig.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables.[1])
46 _, err = nftlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/.ReadConfigscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/ReadConfig().()
47 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/NoError().(t, err)
48
49 newConfig, err = nftlibscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/.ApplyConfigEchoscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/lib`/ApplyConfigEcho().(config)
50 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/NoError().(t, err)
51 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.Lenscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/Len().(t, newConfig.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables., 1, "Expecting just the empty table entry")
52 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/Equal().(t, config.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables., newConfig.Nftablesscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Root#Nftables.)
53 })
54 }