Skip to content

Commit

Permalink
Move Function Rotate Certificate to Utils file
Browse files Browse the repository at this point in the history
Signed-off-by: est-suse <esteban.esquivel@suse.com>
  • Loading branch information
est-suse committed Apr 5, 2023
1 parent b3eaef9 commit e1e98bc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 145 deletions.
130 changes: 0 additions & 130 deletions tests/e2e/certrotation/certrotation_test.go

This file was deleted.

14 changes: 0 additions & 14 deletions tests/e2e/rotatecertificate/rotatecertificate.go

This file was deleted.

2 changes: 1 addition & 1 deletion tests/e2e/rotatecertificate/rotatecertificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var _ = Describe("Verify Custom CA Rotation", Ordered, func() {
var finalErr error
errStop := e2e.StopCluster(serverNodeNames)
Expect(errStop).NotTo(HaveOccurred(), "Server not stop correctly")
errRotate := rotateCertificate(serverNodeNames)
errRotate := e2e.RotateCertificate(serverNodeNames)
Expect(errRotate).NotTo(HaveOccurred(), "Certificate not rotate correctly")
errStart := e2e.StartCluster(serverNodeNames)
Expect(errStart).NotTo(HaveOccurred(), "Server not start correctly")
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions tests/e2e/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,17 @@ func StopCluster(nodeNames []string) error {
return nil
}

// rotateCertificate rotate the Certificate on each node given
func RotateCertificate(nodeNames []string) error {
for _, nodeName := range nodeNames {
cmd := "sudo k3s --debug certificate rotate"
if _, err := RunCmdOnNode(cmd, nodeName); err != nil {
return err
}
}
return nil
}

// RunCmdOnNode executes a command from within the given node
func RunCmdOnNode(cmd string, nodename string) (string, error) {
runcmd := "vagrant ssh -c \"" + cmd + "\" " + nodename
Expand Down

0 comments on commit e1e98bc

Please sign in to comment.