Debian Codegraph @

nft/config/chain_test.go

raw symbols SCIP
1 /*
2 * This file is part of the go-nft project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * Copyright 2021 Red Hat, Inc.
17 *
18 */
19
20 package config_testscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/
21
22 import (
23 "fmtscip-go gomod github.com/golang/go/src go1.16 fmt/"
24 "stringsscip-go gomod github.com/golang/go/src go1.16 strings/"
25 "testingscip-go gomod github.com/golang/go/src go1.16 testing/"
26
27 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`/"
28
29 "github.com/networkplumbing/go-nft/nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/"
30 "github.com/networkplumbing/go-nft/nft/schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/"
31 )
32
33 type chainActionscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainAction# string
34
35 type chainActionFuncscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainActionFunc# func(*nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/Config#, *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Chainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Chain#)
36
37 // Chain Actions
38 const (
39 chainADDscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainADD. chainActionscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainAction# = "add"
40 chainDELETEscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainDELETE. chainActionscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainAction# = "delete"
41 chainFLUSHscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainFLUSH. chainActionscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainAction# = "flush"
42 )
43
44 const chainNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainName. = "test-chain"
45
46 func TestChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/TestChain().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
47 testAddBaseChainsscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/testAddBaseChains().(t)
48 // Removal of base-chains is identical to the removal of regular-chains.
49 // Therefore, such scenarios are evaluated through the regular-chains actions
50 testRegularChainsActionsscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/testRegularChainsActions().(t)
51
52 testChainLookupscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/testChainLookup().(t)
53 }
54
55 func testAddBaseChainsscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/testAddBaseChains().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
56 types := []nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.ChainTypescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/ChainType#{
57 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.TypeFilterscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/TypeFilter.,
58 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.TypeNATscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/TypeNAT.,
59 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.TypeRoutescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/TypeRoute.,
60 }
61 hooks := []nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.ChainHookscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/ChainHook#{
62 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookPreRoutingscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookPreRouting.,
63 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookInputscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookInput.,
64 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookOutputscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookOutput.,
65 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookForwardscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookForward.,
66 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookPostRoutingscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookPostRouting.,
67 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookIngressscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookIngress.,
68 }
69 policies := []nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.ChainPolicyscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/ChainPolicy#{
70 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.PolicyAcceptscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/PolicyAccept.,
71 nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.PolicyDropscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/PolicyDrop.,
72 "",
73 }
74
75 table := 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().(tableNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/tableName., 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.)
76
77 for _, ctype := range types {
78 for _, hook := range hooks {
79 for _, policy := range policies {
80 testName := createChainTestNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/createChainTestName().(chainADDscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainADD., ctype, hook, policy)
81
82 t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(testName, 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#) {
83 priority := 100
84 chain := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewChain().(table, chainNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainName., &ctype, &hook, &priority, &policy)
85 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().()
86 config.AddChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#AddChain().(chain)
87
88 serializedConfig, err := config.ToJSONscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#ToJSON().()
89 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)
90
91 chainArgs := fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().(
92 `"family":%q,"table":%q,"name":%q,"type":%q,"hook":%q,"prio":%d`,
93 table.Familyscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Family., table.Namescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Name., chainNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainName., ctype, hook, priority,
94 )
95 if policy != "" {
96 chainArgs += fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().(`,"policy":%q`, policy)
97 }
98 expected := []byte(fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().(`{"nftables":[{"chain":{%s}}]}`, chainArgs))
99 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, string(expected), string(serializedConfig))
100 })
101 }
102 }
103 }
104 }
105
106 func testRegularChainsActionsscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/testRegularChainsActions().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
107 actions := map[chainActionscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainAction#]chainActionFuncscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainActionFunc#{
108 chainADDscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainADD.: func(c *nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/Config#, chain *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Chainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Chain#) { c.AddChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#AddChain().(chain) },
109 chainDELETEscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainDELETE.: func(c *nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/Config#, chain *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Chainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Chain#) { c.DeleteChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#DeleteChain().(chain) },
110 chainFLUSHscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainFLUSH.: func(c *nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.Configscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/Config#, chain *schemascip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/.Chainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Chain#) { c.FlushChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#FlushChain().(chain) },
111 }
112
113 table := 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().(tableNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/tableName., 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.)
114 chain := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewRegularChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewRegularChain().(table, chainNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainName.)
115
116 for action, actionFunc := range actions {
117 testName := createChainTestNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/createChainTestName().(action, "", "", "")
118
119 t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().(testName, 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#) {
120 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().()
121 actionFunc(config, chain)
122
123 serializedConfig, err := config.ToJSONscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#ToJSON().()
124 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)
125
126 chainArgs := fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().(`"family":%q,"table":%q,"name":%q`, table.Familyscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Family., table.Namescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/schema`/Table#Name., chainNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainName.)
127 var expected []byte
128 if action == chainADDscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainADD. {
129 expected = []byte(fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().(`{"nftables":[{"chain":{%s}}]}`, chainArgs))
130 } else {
131 expected = []byte(fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().(`{"nftables":[{%q:{"chain":{%s}}}]}`, action, chainArgs))
132 }
133
134 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, string(expected), string(serializedConfig))
135 })
136 }
137 }
138
139 func createChainTestNamescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/createChainTestName().(action chainActionscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/chainAction#, ctype nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.ChainTypescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/ChainType#, hook nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.ChainHookscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/ChainHook#, policy nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.ChainPolicyscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/ChainPolicy#) string {
140 args := []string{string(action)}
141 if ctype != "" {
142 args = append(args, string(ctype))
143 }
144 if hook != "" {
145 args = append(args, string(hook))
146 }
147 if policy != "" {
148 args = append(args, string(policy))
149 }
150
151 return stringsscip-go gomod github.com/golang/go/src go1.16 strings/.Joinscip-go gomod github.com/golang/go/src go1.16 strings/Join().(args, " ")
152 }
153
154 func testChainLookupscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config_test`/testChainLookup().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
155 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().()
156 table_br := 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().("table-br", nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.FamilyBridgescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/FamilyBridge.)
157 config.AddTablescip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#AddTable().(table_br)
158
159 chainRegular := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewRegularChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewRegularChain().(table_br, "chain-regular")
160 config.AddChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#AddChain().(chainRegular)
161
162 ctype, hook, prio, policy := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.TypeFilterscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/TypeFilter., nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookPreRoutingscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookPreRouting., 100, nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.PolicyAcceptscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/PolicyAccept.
163 chainBase := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewChain().(table_br, "chain-base", &ctype, &hook, &prio, &policy)
164 config.AddChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#AddChain().(chainBase)
165
166 t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().("Lookup an existing regular chain", 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#) {
167 chain := config.LookupChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#LookupChain().(chainRegular)
168 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, chainRegular, chain)
169 })
170
171 t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().("Lookup an existing base chain", 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#) {
172 chain := config.LookupChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#LookupChain().(chainBase)
173 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, chainBase, chain)
174 })
175
176 t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().("Lookup a missing regular chain", 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#) {
177 chain := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewRegularChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewRegularChain().(table_br, "chain-na")
178 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/Nil().(t, config.LookupChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#LookupChain().(chain))
179 })
180
181 t.Runscip-go gomod github.com/golang/go/src go1.16 testing/T#Run().("Lookup a missing base chain", 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#) {
182 inputHook := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.HookInputscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/HookInput.
183 chain := nftscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/.NewChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft`/NewChain().(table_br, "chain-base", &ctype, &inputHook, &prio, &policy)
184 assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/Nil().(t, config.LookupChainscip-go gomod github.com/networkplumbing/go-nft . `github.com/networkplumbing/go-nft/nft/config`/Config#LookupChain().(chain))
185 })
186 }