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
97c69546
Unverified
Commit
97c69546
authored
Jun 15, 2022
by
ShylajaDevadiga
Committed by
GitHub
Jun 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add arm tests and upgrade tests (#5526)
Signed-off-by:
Shylaja Devadiga
<
shylaja@rancher.com
>
parent
a693071c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
73 deletions
+81
-73
Dockerfile.build
tests/terraform/Dockerfile.build
+5
-4
ingress.yaml
tests/terraform/arm_resource_files/ingress.yaml
+38
-35
createcluster.go
tests/terraform/createcluster.go
+3
-2
createcluster_test.go
tests/terraform/createcluster_test.go
+24
-22
jenkinsfile
tests/terraform/jenkinsfile
+6
-6
testutils.go
tests/terraform/testutils.go
+5
-4
upgradecluster_test.go
tests/terraform/upgradecluster_test.go
+0
-0
No files found.
tests/terraform/Dockerfile.build
View file @
97c69546
...
@@ -19,7 +19,8 @@ RUN apk update && \
...
@@ -19,7 +19,8 @@ RUN apk update && \
WORKDIR $GOPATH/src/github.com/k3s-io/k3s
WORKDIR $GOPATH/src/github.com/k3s-io/k3s
COPY . .
COPY . .
RUN go install github.com/gruntwork-io/terratest/modules/terraform
RUN go get github.com/gruntwork-io/terratest/modules/terraform
RUN go install -u github.com/onsi/gomega
RUN go get -u github.com/onsi/gomega
RUN go install -u github.com/onsi/ginkgo/v2
RUN go get -u github.com/onsi/ginkgo/v2
RUN go install -u golang.org/x/crypto/...
RUN go get -u golang.org/x/crypto/...
RUN go get -u github.com/Thatooine/go-test-html-report
tests/terraform/arm_resource_files/ingress.yaml
View file @
97c69546
apiVersion
:
extensions/v1beta
1
apiVersion
:
networking.k8s.io/v
1
kind
:
Ingress
kind
:
Ingress
metadata
:
metadata
:
name
:
ingress
name
:
test-
ingress
spec
:
spec
:
rules
:
rules
:
-
host
:
foo1.bar.com
-
host
:
foo1.bar.com
http
:
http
:
paths
:
paths
:
-
path
:
/name.html
-
backend
:
backend
:
service
:
serviceName
:
nginx-ingress-svc
name
:
nginx-ingress-svc
servicePort
:
80
port
:
number
:
80
path
:
/
pathType
:
ImplementationSpecific
---
---
apiVersion
:
v1
apiVersion
:
v1
kind
:
Service
kind
:
Service
metadata
:
metadata
:
name
:
nginx-ingress-svc
name
:
nginx-ingress-svc
labels
:
labels
:
k8s-app
:
nginx-app-ingress
k8s-app
:
nginx-app-ingress
spec
:
spec
:
ports
:
ports
:
-
port
:
80
-
port
:
80
targetPort
:
80
targetPort
:
80
protocol
:
TCP
protocol
:
TCP
name
:
http
name
:
http
selector
:
selector
:
k8s-app
:
nginx-app-ingress
k8s-app
:
nginx-app-ingress
---
---
apiVersion
:
v1
apiVersion
:
v1
kind
:
ReplicationController
kind
:
ReplicationController
metadata
:
metadata
:
name
:
test-ingress
name
:
test-ingress
spec
:
spec
:
replicas
:
2
replicas
:
2
selector
:
selector
:
k8s-app
:
nginx-app-ingress
k8s-app
:
nginx-app-ingress
template
:
template
:
metadata
:
metadata
:
labels
:
labels
:
k8s-app
:
nginx-app-ingress
k8s-app
:
nginx-app-ingress
spec
:
spec
:
terminationGracePeriodSeconds
:
60
terminationGracePeriodSeconds
:
60
containers
:
containers
:
-
name
:
testcontainer
-
name
:
testcontainer
image
:
shylajarancher19/shylajaarm64:v1.0
image
:
shylajarancher19/shylajaarm64:v1.0
ports
:
ports
:
-
containerPort
:
80
-
containerPort
:
80
tests/terraform/createcluster.go
View file @
97c69546
...
@@ -3,6 +3,7 @@ package e2e
...
@@ -3,6 +3,7 @@ package e2e
import
(
import
(
"flag"
"flag"
"fmt"
"fmt"
"path/filepath"
"path/filepath"
"testing"
"testing"
...
@@ -17,6 +18,7 @@ var clusterType = flag.String("cluster_type", "etcd", "a string")
...
@@ -17,6 +18,7 @@ var clusterType = flag.String("cluster_type", "etcd", "a string")
var
resourceName
=
flag
.
String
(
"resource_name"
,
"etcd"
,
"a string"
)
var
resourceName
=
flag
.
String
(
"resource_name"
,
"etcd"
,
"a string"
)
var
sshuser
=
flag
.
String
(
"sshuser"
,
"ubuntu"
,
"a string"
)
var
sshuser
=
flag
.
String
(
"sshuser"
,
"ubuntu"
,
"a string"
)
var
sshkey
=
flag
.
String
(
"sshkey"
,
""
,
"a string"
)
var
sshkey
=
flag
.
String
(
"sshkey"
,
""
,
"a string"
)
var
failed
=
false
var
(
var
(
kubeConfigFile
string
kubeConfigFile
string
...
@@ -24,8 +26,7 @@ var (
...
@@ -24,8 +26,7 @@ var (
workerIPs
string
workerIPs
string
)
)
func
BuildCluster
(
nodeOs
,
clusterType
,
externalDb
,
resourceName
string
,
t
*
testing
.
T
,
destroy
bool
)
(
string
,
string
,
string
,
error
)
{
func
BuildCluster
(
nodeOs
,
clusterType
,
externalDb
,
resourceName
string
,
t
*
testing
.
T
,
destroy
bool
,
arch
string
)
(
string
,
string
,
string
,
error
)
{
tDir
:=
"./modules/k3scluster"
tDir
:=
"./modules/k3scluster"
vDir
:=
"/config/"
+
nodeOs
+
clusterType
+
".tfvars"
vDir
:=
"/config/"
+
nodeOs
+
clusterType
+
".tfvars"
...
...
tests/terraform/createcluster_test.go
View file @
97c69546
...
@@ -14,19 +14,16 @@ import (
...
@@ -14,19 +14,16 @@ import (
func
Test_E2EClusterCreateValidation
(
t
*
testing
.
T
)
{
func
Test_E2EClusterCreateValidation
(
t
*
testing
.
T
)
{
RegisterFailHandler
(
Fail
)
RegisterFailHandler
(
Fail
)
flag
.
Parse
()
flag
.
Parse
()
RunSpecs
(
t
,
"Create Cluster Test Suite"
)
RunSpecs
(
t
,
"Create Cluster Test Suite"
)
}
}
var
_
=
Describe
(
"Test:"
,
func
()
{
var
_
=
Describe
(
"Test:"
,
func
()
{
Context
(
"Build Cluster:"
,
func
()
{
Context
(
"Build Cluster:"
,
func
()
{
It
(
"Starts up with no issues"
,
func
()
{
It
(
"Starts up with no issues"
,
func
()
{
kubeConfigFile
,
masterIPs
,
workerIPs
,
err
=
BuildCluster
(
*
nodeOs
,
*
clusterType
,
*
externalDb
,
*
resourceName
,
&
testing
.
T
{},
*
destroy
)
kubeConfigFile
,
masterIPs
,
workerIPs
,
err
=
BuildCluster
(
*
nodeOs
,
*
clusterType
,
*
externalDb
,
*
resourceName
,
&
testing
.
T
{},
*
destroy
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
defer
GinkgoRecover
()
defer
GinkgoRecover
()
if
*
destroy
{
fmt
.
Printf
(
"
\n
Cluster is being Deleted
\n
"
)
return
}
fmt
.
Println
(
"
\n
CLUSTER CONFIG:
\n
OS"
,
*
nodeOs
,
"BACKEND"
,
*
clusterType
,
*
externalDb
)
fmt
.
Println
(
"
\n
CLUSTER CONFIG:
\n
OS"
,
*
nodeOs
,
"BACKEND"
,
*
clusterType
,
*
externalDb
)
fmt
.
Printf
(
"
\n
IPs:
\n
"
)
fmt
.
Printf
(
"
\n
IPs:
\n
"
)
fmt
.
Println
(
"Server Node IPS:"
,
masterIPs
)
fmt
.
Println
(
"Server Node IPS:"
,
masterIPs
)
...
@@ -62,7 +59,7 @@ var _ = Describe("Test:", func() {
...
@@ -62,7 +59,7 @@ var _ = Describe("Test:", func() {
})
})
It
(
"Verifies ClusterIP Service"
,
func
()
{
It
(
"Verifies ClusterIP Service"
,
func
()
{
_
,
err
:=
DeployWorkload
(
"clusterip.yaml"
,
kubeConfigFile
,
false
)
_
,
err
:=
DeployWorkload
(
"clusterip.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Cluster IP manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Cluster IP manifest not deployed"
)
Eventually
(
func
(
g
Gomega
)
{
Eventually
(
func
(
g
Gomega
)
{
...
@@ -81,13 +78,13 @@ var _ = Describe("Test:", func() {
...
@@ -81,13 +78,13 @@ var _ = Describe("Test:", func() {
res
,
err
:=
RunCmdOnNode
(
cmd
,
ip
,
*
sshuser
,
*
sshkey
)
res
,
err
:=
RunCmdOnNode
(
cmd
,
ip
,
*
sshuser
,
*
sshkey
)
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-clusterip"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-clusterip"
))
fmt
.
Println
(
res
)
},
"420s"
,
"10s"
)
.
Should
(
Succeed
())
},
"420s"
,
"10s"
)
.
Should
(
Succeed
())
}
}
})
})
It
(
"Verifies NodePort Service"
,
func
()
{
It
(
"Verifies NodePort Service"
,
func
()
{
_
,
err
:=
DeployWorkload
(
"nodeport.yaml"
,
kubeConfigFile
,
false
)
_
,
err
:=
DeployWorkload
(
"nodeport.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"NodePort manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"NodePort manifest not deployed"
)
nodeExternalIP
:=
FetchNodeExternalIP
(
kubeConfigFile
)
nodeExternalIP
:=
FetchNodeExternalIP
(
kubeConfigFile
)
cmd
:=
"kubectl get service nginx-nodeport-svc --kubeconfig="
+
kubeConfigFile
+
" --output jsonpath=
\"
{.spec.ports[0].nodePort}
\"
"
cmd
:=
"kubectl get service nginx-nodeport-svc --kubeconfig="
+
kubeConfigFile
+
" --output jsonpath=
\"
{.spec.ports[0].nodePort}
\"
"
...
@@ -109,12 +106,13 @@ var _ = Describe("Test:", func() {
...
@@ -109,12 +106,13 @@ var _ = Describe("Test:", func() {
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
fmt
.
Println
(
res
)
fmt
.
Println
(
res
)
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-nodeport"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-nodeport"
))
fmt
.
Println
(
res
)
},
"240s"
,
"5s"
)
.
Should
(
Succeed
())
},
"240s"
,
"5s"
)
.
Should
(
Succeed
())
}
}
})
})
It
(
"Verifies LoadBalancer Service"
,
func
()
{
It
(
"Verifies LoadBalancer Service"
,
func
()
{
_
,
err
:=
DeployWorkload
(
"loadbalancer.yaml"
,
kubeConfigFile
,
false
)
_
,
err
:=
DeployWorkload
(
"loadbalancer.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Loadbalancer manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Loadbalancer manifest not deployed"
)
nodeExternalIP
:=
FetchNodeExternalIP
(
kubeConfigFile
)
nodeExternalIP
:=
FetchNodeExternalIP
(
kubeConfigFile
)
cmd
:=
"kubectl get service nginx-loadbalancer-svc --kubeconfig="
+
kubeConfigFile
+
" --output jsonpath=
\"
{.spec.ports[0].port}
\"
"
cmd
:=
"kubectl get service nginx-loadbalancer-svc --kubeconfig="
+
kubeConfigFile
+
" --output jsonpath=
\"
{.spec.ports[0].port}
\"
"
...
@@ -136,12 +134,13 @@ var _ = Describe("Test:", func() {
...
@@ -136,12 +134,13 @@ var _ = Describe("Test:", func() {
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
fmt
.
Println
(
res
)
fmt
.
Println
(
res
)
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-loadbalancer"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-loadbalancer"
))
fmt
.
Println
(
res
)
},
"240s"
,
"5s"
)
.
Should
(
Succeed
())
},
"240s"
,
"5s"
)
.
Should
(
Succeed
())
}
}
})
})
It
(
"Verifies Ingress"
,
func
()
{
It
(
"Verifies Ingress"
,
func
()
{
_
,
err
:=
DeployWorkload
(
"ingress.yaml"
,
kubeConfigFile
,
false
)
_
,
err
:=
DeployWorkload
(
"ingress.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Ingress manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Ingress manifest not deployed"
)
Eventually
(
func
(
g
Gomega
)
{
Eventually
(
func
(
g
Gomega
)
{
...
@@ -162,12 +161,13 @@ var _ = Describe("Test:", func() {
...
@@ -162,12 +161,13 @@ var _ = Describe("Test:", func() {
res
,
err
:=
RunCommand
(
cmd
)
res
,
err
:=
RunCommand
(
cmd
)
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
g
.
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-ingress"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"test-ingress"
))
fmt
.
Println
(
res
)
},
"240s"
,
"5s"
)
.
Should
(
Succeed
())
},
"240s"
,
"5s"
)
.
Should
(
Succeed
())
}
}
})
})
It
(
"Verifies Daemonset"
,
func
()
{
It
(
"Verifies Daemonset"
,
func
()
{
_
,
err
:=
DeployWorkload
(
"daemonset.yaml"
,
kubeConfigFile
,
false
)
_
,
err
:=
DeployWorkload
(
"daemonset.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Daemonset manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Daemonset manifest not deployed"
)
nodes
,
_
:=
ParseNodes
(
kubeConfigFile
,
false
)
nodes
,
_
:=
ParseNodes
(
kubeConfigFile
,
false
)
...
@@ -184,7 +184,7 @@ var _ = Describe("Test:", func() {
...
@@ -184,7 +184,7 @@ var _ = Describe("Test:", func() {
})
})
It
(
"Verifies Local Path Provisioner storage "
,
func
()
{
It
(
"Verifies Local Path Provisioner storage "
,
func
()
{
_
,
err
:=
DeployWorkload
(
"local-path-provisioner.yaml"
,
kubeConfigFile
,
false
)
_
,
err
:=
DeployWorkload
(
"local-path-provisioner.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"local-path-provisioner manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"local-path-provisioner manifest not deployed"
)
Eventually
(
func
(
g
Gomega
)
{
Eventually
(
func
(
g
Gomega
)
{
...
@@ -200,7 +200,6 @@ var _ = Describe("Test:", func() {
...
@@ -200,7 +200,6 @@ var _ = Describe("Test:", func() {
cmd
:=
"kubectl get pod volume-test --kubeconfig="
+
kubeConfigFile
cmd
:=
"kubectl get pod volume-test --kubeconfig="
+
kubeConfigFile
res
,
err
:=
RunCommand
(
cmd
)
res
,
err
:=
RunCommand
(
cmd
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
fmt
.
Println
(
res
)
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"volume-test"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"volume-test"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"Running"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"Running"
))
},
"420s"
,
"2s"
)
.
Should
(
Succeed
())
},
"420s"
,
"2s"
)
.
Should
(
Succeed
())
...
@@ -215,7 +214,7 @@ var _ = Describe("Test:", func() {
...
@@ -215,7 +214,7 @@ var _ = Describe("Test:", func() {
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
fmt
.
Println
(
res
)
fmt
.
Println
(
res
)
_
,
err
=
DeployWorkload
(
"local-path-provisioner.yaml"
,
kubeConfigFile
,
false
)
_
,
err
=
DeployWorkload
(
"local-path-provisioner.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"local-path-provisioner manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"local-path-provisioner manifest not deployed"
)
Eventually
(
func
(
g
Gomega
)
{
Eventually
(
func
(
g
Gomega
)
{
...
@@ -244,7 +243,7 @@ var _ = Describe("Test:", func() {
...
@@ -244,7 +243,7 @@ var _ = Describe("Test:", func() {
})
})
It
(
"Verifies dns access"
,
func
()
{
It
(
"Verifies dns access"
,
func
()
{
_
,
err
:=
DeployWorkload
(
"dnsutils.yaml"
,
kubeConfigFile
,
false
)
_
,
err
:=
DeployWorkload
(
"dnsutils.yaml"
,
kubeConfigFile
,
*
arch
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"dnsutils manifest not deployed"
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"dnsutils manifest not deployed"
)
Eventually
(
func
(
g
Gomega
)
{
Eventually
(
func
(
g
Gomega
)
{
...
@@ -260,15 +259,11 @@ var _ = Describe("Test:", func() {
...
@@ -260,15 +259,11 @@ var _ = Describe("Test:", func() {
res
,
_
:=
RunCommand
(
cmd
)
res
,
_
:=
RunCommand
(
cmd
)
fmt
.
Println
(
res
)
fmt
.
Println
(
res
)
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"kubernetes.default.svc.cluster.local"
))
g
.
Expect
(
res
)
.
Should
(
ContainSubstring
(
"kubernetes.default.svc.cluster.local"
))
fmt
.
Println
(
res
)
},
"420s"
,
"2s"
)
.
Should
(
Succeed
())
},
"420s"
,
"2s"
)
.
Should
(
Succeed
())
})
})
It
(
"Validate Rebooting nodes"
,
func
()
{
It
(
"Validate Rebooting nodes"
,
func
()
{
if
*
destroy
{
return
}
defer
GinkgoRecover
()
nodeExternalIP
:=
FetchNodeExternalIP
(
kubeConfigFile
)
nodeExternalIP
:=
FetchNodeExternalIP
(
kubeConfigFile
)
for
_
,
ip
:=
range
nodeExternalIP
{
for
_
,
ip
:=
range
nodeExternalIP
{
fmt
.
Println
(
"
\n
Rebooting node: "
,
ip
)
fmt
.
Println
(
"
\n
Rebooting node: "
,
ip
)
...
@@ -303,16 +298,23 @@ var _ = Describe("Test:", func() {
...
@@ -303,16 +298,23 @@ var _ = Describe("Test:", func() {
})
})
})
})
var
failed
=
false
var
_
=
AfterEach
(
func
()
{
var
_
=
AfterEach
(
func
()
{
failed
=
failed
||
CurrentGinkgoTestDescription
()
.
Failed
failed
=
failed
||
CurrentGinkgoTestDescription
()
.
Failed
})
})
var
_
=
BeforeEach
(
func
()
{
failed
=
failed
||
CurrentGinkgoTestDescription
()
.
Failed
if
*
destroy
{
fmt
.
Printf
(
"
\n
Cluster is being Deleted
\n
"
)
Skip
(
"Cluster is being Deleted"
)
}
})
var
_
=
AfterSuite
(
func
()
{
var
_
=
AfterSuite
(
func
()
{
if
failed
{
if
failed
{
fmt
.
Println
(
"FAILED!"
)
fmt
.
Println
(
"FAILED!"
)
}
else
{
}
else
{
kubeConfigFile
,
masterIPs
,
workerIPs
,
err
=
BuildCluster
(
*
nodeOs
,
*
clusterType
,
*
externalDb
,
*
resourceName
,
&
testing
.
T
{},
true
)
kubeConfigFile
,
masterIPs
,
workerIPs
,
err
=
BuildCluster
(
*
nodeOs
,
*
clusterType
,
*
externalDb
,
*
resourceName
,
&
testing
.
T
{},
true
,
*
arch
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"Error Destroying Cluster"
,
err
)
fmt
.
Println
(
"Error Destroying Cluster"
,
err
)
}
}
...
...
tests/terraform/jenkinsfile
View file @
97c69546
...
@@ -34,16 +34,16 @@ pipeline {
...
@@ -34,16 +34,16 @@ pipeline {
vpc_id="${env.VPC_ID}"
vpc_id="${env.VPC_ID}"
subnets="${env.SUBNETS}"
subnets="${env.SUBNETS}"
qa_space="${env.QA_SPACE}"
qa_space="${env.QA_SPACE}"
ec2_instance_class="${env.
EC2_INSTANCE_CLASS
}"
ec2_instance_class="${env.
AWS_INSTANCE_TYPE
}"
access_key="/config/$AWS_SSH_KEY_NAME"
access_key="/config/$AWS_SSH_KEY_NAME"
no_of_worker_nodes="${env.NO_OF_WORKER_NODES}"
no_of_worker_nodes="${env.NO_OF_WORKER_NODES}"
key_name="jenkins-rke-validation"
key_name="jenkins-rke-validation"
server_flags="${env.SERVER_FLAGS}"
server_flags="${env.
K3S_
SERVER_FLAGS}"
worker_flags="${env.WORKER_FLAGS}"
worker_flags="${env.
K3S_
WORKER_FLAGS}"
k3s_version="${env.K3S_VERSION}"
k3s_version="${env.K3S_VERSION}"
availability_zone="${env.AVAILABILITY_ZONE}"
availability_zone="${env.AVAILABILITY_ZONE}"
sg_id="${env.SG_ID}"
sg_id="${env.SG_ID}"
install_mode="${env.INSTALL_MODE}"
install_mode="${env.
K3S_
INSTALL_MODE}"
resource_name="${env.RESOURCE_NAME}"
resource_name="${env.RESOURCE_NAME}"
no_of_server_nodes="${env.NO_OF_SERVER_NODES}"
no_of_server_nodes="${env.NO_OF_SERVER_NODES}"
username="${env.RHEL_USERNAME}"
username="${env.RHEL_USERNAME}"
...
@@ -51,8 +51,8 @@ pipeline {
...
@@ -51,8 +51,8 @@ pipeline {
db_username="${env.DB_USERNAME}"
db_username="${env.DB_USERNAME}"
db_password="${env.DB_PASSWORD}"
db_password="${env.DB_PASSWORD}"
node_os="${env.NODE_OS}"
node_os="${env.NODE_OS}"
environment="${env.ENVIRONMENT}"
environment="${env.
DB_
ENVIRONMENT}"
engine_mode="${env.ENGINE_MODE}"
engine_mode="${env.
DB_
ENGINE_MODE}"
external_db="${env.EXTERNAL_DB}"
external_db="${env.EXTERNAL_DB}"
external_db_version="${env.EXTERNAL_DB_VERSION}"
external_db_version="${env.EXTERNAL_DB_VERSION}"
instance_class="${env.DB_INSTANCE_CLASS}"
instance_class="${env.DB_INSTANCE_CLASS}"
...
...
tests/terraform/testutils.go
View file @
97c69546
...
@@ -17,6 +17,7 @@ type Node struct {
...
@@ -17,6 +17,7 @@ type Node struct {
Name
string
Name
string
Status
string
Status
string
Roles
string
Roles
string
Version
string
InternalIP
string
InternalIP
string
ExternalIP
string
ExternalIP
string
}
}
...
@@ -92,7 +93,6 @@ func runsshCommand(cmd string, conn *ssh.Client) (string, error) {
...
@@ -92,7 +93,6 @@ func runsshCommand(cmd string, conn *ssh.Client) (string, error) {
// RunCmdOnNode executes a command from within the given node
// RunCmdOnNode executes a command from within the given node
func
RunCmdOnNode
(
cmd
string
,
ServerIP
string
,
SSHUser
string
,
SSHKey
string
)
(
string
,
error
)
{
func
RunCmdOnNode
(
cmd
string
,
ServerIP
string
,
SSHUser
string
,
SSHKey
string
)
(
string
,
error
)
{
Server
:=
ServerIP
+
":22"
Server
:=
ServerIP
+
":22"
fmt
.
Println
(
Server
,
SSHUser
,
SSHKey
)
conn
:=
ConfigureSSH
(
Server
,
SSHUser
,
SSHKey
)
conn
:=
ConfigureSSH
(
Server
,
SSHUser
,
SSHKey
)
res
,
err
:=
runsshCommand
(
cmd
,
conn
)
res
,
err
:=
runsshCommand
(
cmd
,
conn
)
res
=
strings
.
TrimSpace
(
res
)
res
=
strings
.
TrimSpace
(
res
)
...
@@ -117,10 +117,10 @@ func CountOfStringInSlice(str string, pods []Pod) int {
...
@@ -117,10 +117,10 @@ func CountOfStringInSlice(str string, pods []Pod) int {
return
count
return
count
}
}
func
DeployWorkload
(
workload
,
kubeconfig
string
,
arch
bool
)
(
string
,
error
)
{
func
DeployWorkload
(
workload
,
kubeconfig
string
,
arch
string
)
(
string
,
error
)
{
resourceDir
:=
"./amd64_resource_files"
resourceDir
:=
"./amd64_resource_files"
if
arch
{
if
arch
==
"arm64"
{
resourceDir
=
"./arm
64
_resource_files"
resourceDir
=
"./arm_resource_files"
}
}
files
,
err
:=
ioutil
.
ReadDir
(
resourceDir
)
files
,
err
:=
ioutil
.
ReadDir
(
resourceDir
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -186,6 +186,7 @@ func ParseNodes(kubeConfig string, print bool) ([]Node, error) {
...
@@ -186,6 +186,7 @@ func ParseNodes(kubeConfig string, print bool) ([]Node, error) {
Name
:
fields
[
0
],
Name
:
fields
[
0
],
Status
:
fields
[
1
],
Status
:
fields
[
1
],
Roles
:
fields
[
2
],
Roles
:
fields
[
2
],
Version
:
fields
[
4
],
InternalIP
:
fields
[
5
],
InternalIP
:
fields
[
5
],
ExternalIP
:
fields
[
6
],
ExternalIP
:
fields
[
6
],
}
}
...
...
tests/terraform/upgradecluster_test.go
0 → 100644
View file @
97c69546
This diff is collapsed.
Click to expand it.
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