Debian Codegraph @

tests/readiness_test.go

raw symbols SCIP
1 /*
2 Copyright 2022 The Kubernetes Authors.
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
17 package testsscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/
18
19 import "testingscip-go gomod github.com/golang/go/src go1.23.6 testing/"
20
21 func TestGRPCServerAndAgentReadinessscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/TestGRPCServerAndAgentReadiness().(t *testingscip-go gomod github.com/golang/go/src go1.23.6 testing/.Tscip-go gomod github.com/golang/go/src go1.23.6 testing/T#) {
22 ps := runGRPCProxyServerWithServerCountscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/runGRPCProxyServerWithServerCount().(t, 1)
23 defer ps.Stopscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/ProxyServer#Stop.()
24
25 if ps.Readyscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/ProxyServer#Ready.() {
26 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.6 testing/common#Fatalf().("expected not ready")
27 }
28
29 a := runAgentscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/runAgent().(t, ps.AgentAddrscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/ProxyServer#AgentAddr.())
30 defer a.Stopscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/Agent#Stop.()
31 waitForConnectedServerCountscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/waitForConnectedServerCount().(t, 1, a)
32
33 // check the agent connected status
34 isAgentReady := a.Readyscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/Agent#Ready.()
35 if !isAgentReady {
36 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.6 testing/common#Fatalf().("expected connection status 'true', got: %t", isAgentReady)
37 }
38 if !ps.Readyscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/ProxyServer#Ready.() {
39 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.6 testing/common#Fatalf().("expected ready")
40 }
41 }
42
43 func TestHTTPConnServerAndAgentReadinessscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/TestHTTPConnServerAndAgentReadiness().(t *testingscip-go gomod github.com/golang/go/src go1.23.6 testing/.Tscip-go gomod github.com/golang/go/src go1.23.6 testing/T#) {
44 ps := runHTTPConnProxyServerscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/runHTTPConnProxyServer().(t)
45 defer ps.Stopscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/ProxyServer#Stop.()
46
47 a := runAgentscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/runAgent().(t, ps.AgentAddrscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/ProxyServer#AgentAddr.())
48 defer a.Stopscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/Agent#Stop.()
49 waitForConnectedServerCountscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/waitForConnectedServerCount().(t, 1, a)
50
51 // check the agent connected status
52 isAgentReady := a.Readyscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/Agent#Ready.()
53 if !isAgentReady {
54 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.6 testing/common#Fatalf().("expected connection status 'true', got: %t", isAgentReady)
55 }
56 }
57
58 func TestAgentReadinessWithoutServerscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/TestAgentReadinessWithoutServer().(t *testingscip-go gomod github.com/golang/go/src go1.23.6 testing/.Tscip-go gomod github.com/golang/go/src go1.23.6 testing/T#) {
59 a := runAgentscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests`/runAgent().(t, "localhost:8080")
60 defer a.Stopscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/Agent#Stop.()
61 // check the agent connected status
62 isAgentReady := a.Readyscip-go gomod sigs.k8s.io/apiserver-network-proxy . `sigs.k8s.io/apiserver-network-proxy/tests/framework`/Agent#Ready.()
63 if isAgentReady {
64 t.Fatalfscip-go gomod github.com/golang/go/src go1.23.6 testing/common#Fatalf().("expected connection status 'false', got: %t", isAgentReady)
65 }
66 }