Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
483d76b3
Commit
483d76b3
authored
Jul 01, 2024
by
Manuel Buil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add int test for flannel-ipv6masq
Signed-off-by:
Manuel Buil
<
mbuil@suse.com
>
parent
13612ef3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
4 deletions
+81
-4
dualstack_int_test.go
tests/integration/dualstack/dualstack_int_test.go
+1
-3
flannelipv6masq_int_test.go
...s/integration/flannelipv6masq/flannelipv6masq_int_test.go
+78
-0
integration.go
tests/integration/integration.go
+2
-1
No files found.
tests/integration/dualstack/dualstack_int_test.go
View file @
483d76b3
...
...
@@ -44,10 +44,8 @@ var _ = Describe("dual stack", Ordered, func() {
},
"180s"
,
"10s"
)
.
Should
(
Succeed
())
})
It
(
"creates pods with two IPs"
,
func
()
{
podname
,
err
:=
testutil
.
K3sCmd
(
"kubectl"
,
"get"
,
"pods"
,
"-n"
,
"kube-system"
,
"-o"
,
"jsonpath={.items[?(@.metadata.labels.app
\\
.kubernetes
\\
.io/name==
\"
traefik
\"
)].metadata.name}"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Eventually
(
func
()
(
string
,
error
)
{
return
testutil
.
K3sCmd
(
"kubectl"
,
"exec"
,
podname
,
"-n"
,
"kube-system"
,
"--"
,
"ip"
,
"a"
)
return
testutil
.
K3sCmd
(
"kubectl"
,
"exec"
,
"deployment/traefik"
,
"-n"
,
"kube-system"
,
"--"
,
"ip"
,
"a"
)
},
"5s"
,
"1s"
)
.
Should
(
ContainSubstring
(
"2001:cafe:42:"
))
})
})
...
...
tests/integration/flannelipv6masq/flannelipv6masq_int_test.go
0 → 100644
View file @
483d76b3
package
integration
import
(
"os"
"strings"
"testing"
testutil
"github.com/k3s-io/k3s/tests/integration"
.
"github.com/onsi/ginkgo/v2"
.
"github.com/onsi/gomega"
)
var
server
*
testutil
.
K3sServer
var
dualStackServeripv6masqArgs
=
[]
string
{
"--cluster-init"
,
"--cluster-cidr"
,
"10.42.0.0/16,2001:cafe:42::/56"
,
"--service-cidr"
,
"10.43.0.0/16,2001:cafe:43::/112"
,
"--disable-network-policy"
,
"--flannel-ipv6-masq"
,
}
var
testLock
int
var
_
=
BeforeSuite
(
func
()
{
if
!
testutil
.
IsExistingServer
()
&&
os
.
Getenv
(
"CI"
)
!=
"true"
{
var
err
error
testLock
,
err
=
testutil
.
K3sTestLock
()
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
server
,
err
=
testutil
.
K3sStartServer
(
dualStackServeripv6masqArgs
...
)
Expect
(
err
)
.
ToNot
(
HaveOccurred
())
}
})
var
_
=
Describe
(
"flannel-ipv6-masq"
,
Ordered
,
func
()
{
BeforeEach
(
func
()
{
if
testutil
.
IsExistingServer
()
&&
!
testutil
.
ServerArgsPresent
(
dualStackServeripv6masqArgs
)
{
Skip
(
"Test needs k3s server with: "
+
strings
.
Join
(
dualStackServeripv6masqArgs
,
" "
))
}
else
if
os
.
Getenv
(
"CI"
)
==
"true"
{
Skip
(
"Github environment does not support IPv6"
)
}
})
When
(
"a ipv4 and ipv6 cidr is present"
,
func
()
{
It
(
"starts up with no problems"
,
func
()
{
Eventually
(
func
()
error
{
return
testutil
.
K3sDefaultDeployments
()
},
"180s"
,
"10s"
)
.
Should
(
Succeed
())
})
It
(
"creates pods with two IPs"
,
func
()
{
Eventually
(
func
()
(
string
,
error
)
{
return
testutil
.
K3sCmd
(
"kubectl"
,
"exec"
,
"deployment/traefik"
,
"-n"
,
"kube-system"
,
"--"
,
"ip"
,
"a"
)
},
"5s"
,
"1s"
)
.
Should
(
ContainSubstring
(
"2001:cafe:42:"
))
})
It
(
"verifies ipv6 masq iptables rule exists"
,
func
()
{
Eventually
(
func
()
(
string
,
error
)
{
return
testutil
.
RunCommand
(
"ip6tables -nt nat -L FLANNEL-POSTRTG"
)
},
"5s"
,
"1s"
)
.
Should
(
ContainSubstring
(
"MASQUERADE"
))
})
})
})
var
failed
bool
var
_
=
AfterEach
(
func
()
{
failed
=
failed
||
CurrentSpecReport
()
.
Failed
()
})
var
_
=
AfterSuite
(
func
()
{
if
!
testutil
.
IsExistingServer
()
&&
os
.
Getenv
(
"CI"
)
!=
"true"
{
if
failed
{
testutil
.
K3sSaveLog
(
server
,
false
)
}
Expect
(
testutil
.
K3sKillServer
(
server
))
.
To
(
Succeed
())
Expect
(
testutil
.
K3sCleanup
(
testLock
,
""
))
.
To
(
Succeed
())
}
})
func
Test_IntegrationFlannelIpv6Masq
(
t
*
testing
.
T
)
{
RegisterFailHandler
(
Fail
)
RunSpecs
(
t
,
"flannel-ipv6-masq Suite"
)
}
tests/integration/integration.go
View file @
483d76b3
...
...
@@ -55,7 +55,7 @@ func findK3sExecutable() string {
break
}
if
i
==
20
{
logrus
.
Fatal
(
"Unable to find k3s executable"
)
logrus
.
Fatal
f
(
"Unable to find k3s executable in %s"
,
k3sBin
)
}
return
k3sBin
}
...
...
@@ -254,6 +254,7 @@ func K3sStartServer(inputArgs ...string) (*K3sServer, error) {
return
nil
,
err
}
cmd
.
Stderr
=
f
logrus
.
Info
(
"Starting k3s server. Check k3log.txt for logs"
)
err
=
cmd
.
Start
()
return
&
K3sServer
{
cmd
,
f
},
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment