Skip to content

Commit 968f99b

Browse files
authored
Merge branch 'main' into TestCoverage3
2 parents 5a9b7bc + 352bd8d commit 968f99b

File tree

6 files changed

+340
-17
lines changed

6 files changed

+340
-17
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ require (
162162
github.com/prometheus/procfs v0.15.1 // indirect
163163
github.com/prometheus/prometheus v0.300.1 // indirect
164164
github.com/quic-go/qpack v0.5.1 // indirect
165-
github.com/quic-go/quic-go v0.48.2 // indirect
165+
github.com/quic-go/quic-go v0.49.1 // indirect
166166
github.com/rivo/uniseg v0.4.7 // indirect
167167
github.com/russross/blackfriday/v2 v2.1.0 // indirect
168168
github.com/ryanuber/go-glob v1.0.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ github.com/prometheus/prometheus v0.300.1 h1:9KKcTTq80gkzmXW0Et/QCFSrBPgmwiS3Hlc
369369
github.com/prometheus/prometheus v0.300.1/go.mod h1:gtTPY/XVyCdqqnjA3NzDMb0/nc5H9hOu1RMame+gHyM=
370370
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
371371
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
372-
github.com/quic-go/quic-go v0.48.2 h1:wsKXZPeGWpMpCGSWqOcqpW2wZYic/8T3aqiOID0/KWE=
373-
github.com/quic-go/quic-go v0.48.2/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs=
372+
github.com/quic-go/quic-go v0.49.1 h1:e5JXpUyF0f2uFjckQzD8jTghZrOUK1xxDqqZhlwixo0=
373+
github.com/quic-go/quic-go v0.49.1/go.mod h1:s2wDnmCdooUQBmQfpUSTCYBl1/D4FcqbULMMkASvR6s=
374374
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
375375
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
376376
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=

pkg/controller/encryption/ipsec/ipsec_controller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
"kmesh.net/kmesh/daemon/options"
4545
"kmesh.net/kmesh/pkg/bpf"
4646
"kmesh.net/kmesh/pkg/constants"
47+
"kmesh.net/kmesh/pkg/controller/encryption"
4748
"kmesh.net/kmesh/pkg/kube"
4849
v1alpha1 "kmesh.net/kmesh/pkg/kube/apis/kmeshnodeinfo/v1alpha1"
4950
fakeKmeshClientset "kmesh.net/kmesh/pkg/kube/nodeinfo/clientset/versioned/fake"
@@ -96,7 +97,7 @@ var (
9697
},
9798
}
9899

99-
testKey = IpSecKey{
100+
testKey = encryption.IpSecKey{
100101
Spi: 1,
101102
AeadKeyName: "rfc4106(gcm(aes))",
102103
AeadKey: DecodeHex("abc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161"),

pkg/controller/encryption/ipsec/ipsec_handler_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/vishvananda/netlink"
3333

3434
"kmesh.net/kmesh/pkg/constants"
35+
"kmesh.net/kmesh/pkg/controller/encryption"
3536
)
3637

3738
// DecodeHex is a utility function to decode a hex string into bytes.
@@ -48,13 +49,13 @@ func TestLoadIPSecKey(t *testing.T) {
4849
aeadKey := DecodeHex("2dc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161")
4950
tests := []struct {
5051
name string
51-
keyData IpSecKey
52+
keyData encryption.IpSecKey
5253
expectError bool
5354
errorMsg string
5455
}{
5556
{ // Valid
5657
name: "valid_rfc4106_key",
57-
keyData: IpSecKey{
58+
keyData: encryption.IpSecKey{
5859
Spi: 1,
5960
AeadKeyName: "rfc4106(gcm(aes))",
6061
AeadKey: aeadKey,
@@ -64,7 +65,7 @@ func TestLoadIPSecKey(t *testing.T) {
6465
},
6566
{
6667
name: "invalid_algo_name",
67-
keyData: IpSecKey{
68+
keyData: encryption.IpSecKey{
6869
Spi: 3,
6970
AeadKeyName: "aes-gcm", // should start with "rfc"
7071
AeadKey: aeadKey,
@@ -75,7 +76,7 @@ func TestLoadIPSecKey(t *testing.T) {
7576
},
7677
{
7778
name: "empty_algo_name",
78-
keyData: IpSecKey{
79+
keyData: encryption.IpSecKey{
7980
Spi: 4,
8081
AeadKeyName: "",
8182
AeadKey: aeadKey,
@@ -161,13 +162,13 @@ func TestLoadIPSecKey(t *testing.T) {
161162
// Test multiple key loading (should update history)
162163
tests = []struct {
163164
name string
164-
keyData IpSecKey
165+
keyData encryption.IpSecKey
165166
expectError bool
166167
errorMsg string
167168
}{
168169
{
169170
name: "first_key",
170-
keyData: IpSecKey{
171+
keyData: encryption.IpSecKey{
171172
Spi: 1,
172173
AeadKeyName: "rfc4106(gcm(aes))",
173174
AeadKey: aeadKey,
@@ -177,7 +178,7 @@ func TestLoadIPSecKey(t *testing.T) {
177178
},
178179
{
179180
name: "second_key",
180-
keyData: IpSecKey{
181+
keyData: encryption.IpSecKey{
181182
Spi: 2,
182183
AeadKeyName: "rfc4106(gcm(aes))",
183184
AeadKey: DecodeHex("abc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161"),
@@ -334,7 +335,7 @@ func hasStateRule(state *netlink.XfrmState) (bool, error) {
334335
func TestCreateStateRule(t *testing.T) {
335336
handler := NewIpSecHandler()
336337
testKey := DecodeHex("2dc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161")
337-
ipsecKey := IpSecKey{
338+
ipsecKey := encryption.IpSecKey{
338339
Spi: 1001,
339340
AeadKeyName: "rfc4106(gcm(aes))",
340341
AeadKey: testKey,
@@ -536,7 +537,7 @@ func TestFlush(t *testing.T) {
536537

537538
// create state rule
538539
testKey := DecodeHex("2dc9410d7cd6b324461bf16db518646594276c5362c30fc476ebca3f1a394b6ed4462161")
539-
ipsecKey := IpSecKey{
540+
ipsecKey := encryption.IpSecKey{
540541
Spi: 1001,
541542
AeadKeyName: "rfc4106(gcm(aes))",
542543
AeadKey: testKey,

0 commit comments

Comments
 (0)