MCPcopy
hub / github.com/antrea-io/antrea / Run

Function Run

pkg/antctl/raw/check/installation/command.go:150–185  ·  view source on GitHub ↗
(o *options)

Source from the content-addressed store, hash-verified

148}
149
150func Run(o *options) error {
151 runFilterRegex, err := compileRunFilter(o.runFilter)
152 if err != nil {
153 return err
154 }
155
156 networkPolicyDelay, err := time.ParseDuration(o.networkPolicyDelay)
157 if err != nil {
158 return fmt.Errorf("NetworkPolicy delay is not a valid duration string: %w", err)
159 }
160 if networkPolicyDelay < minNetworkPolicyDelay {
161 return fmt.Errorf("NetworkPolicy delay should not be less than %v", minNetworkPolicyDelay)
162 }
163
164 client, config, clusterName, err := check.NewClient()
165 if err != nil {
166 return fmt.Errorf("unable to create Kubernetes client: %w", err)
167 }
168 antreaClient, err := antrea.NewForConfig(config)
169 if err != nil {
170 return fmt.Errorf("unable to create Antrea client: %w", err)
171 }
172 ctx := context.Background()
173 testContext := NewTestContext(client, antreaClient, config, clusterName, o.antreaNamespace, runFilterRegex, o.testImage, networkPolicyDelay)
174 defer check.Teardown(ctx, testContext.Logger, testContext.client, testContext.namespace)
175 if err := testContext.setup(ctx); err != nil {
176 return err
177 }
178 stats := testContext.runTests(ctx)
179
180 testContext.Log("Test finished: %v tests succeeded, %v tests failed, %v tests were skipped", stats.numSuccess, stats.numFailure, stats.numSkipped)
181 if stats.numFailure > 0 {
182 return fmt.Errorf("%v/%v tests failed", stats.numFailure, stats.numTotal())
183 }
184 return nil
185}
186
187func tcpProbeCommand(ip string, port int) []string {
188 return []string{"nc", ip, fmt.Sprint(port), "--wait=3s", "-vz"}

Callers 1

CommandFunction · 0.70

Calls 9

NewClientFunction · 0.92
TeardownFunction · 0.92
compileRunFilterFunction · 0.85
ErrorfMethod · 0.80
runTestsMethod · 0.80
LogMethod · 0.80
numTotalMethod · 0.80
NewTestContextFunction · 0.70
setupMethod · 0.45

Tested by

no test coverage detected