Skip to content

Commit

Permalink
Addin specialized utility function for genereting mock ssh secrets
Browse files Browse the repository at this point in the history
These secrets are used in a considerable number of tests. Implementing separate
function for generating them in each repo is suboptimal.

Signed-off-by: Jiri Podivin <[email protected]>
  • Loading branch information
jpodivin committed Oct 4, 2023
1 parent ac38125 commit 5705efd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/common/test/helpers/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ func (tc *TestHelper) CreateEmptySecret(name types.NamespacedName) *corev1.Secre
return tc.CreateSecret(name, map[string][]byte{})
}

// CreateSSHSecret creates new secret containing mock "ssh-privatekey"
//
// Example usage:
//
// sshSecret := th.CreateSSHSecret(types.NamespacedName{Name: "test-ssh-secret", Namespace: "test-namespace"})
func (tc *TestHelper) CreateSSHSecret(name types.NamespacedName) *corev1.Secret {
return tc.CreateSecret(name, map[string][]byte{"ssh-privatekey": []byte("foo")})
}

// DeleteSecret deletes a Secret resource
//
// Example usage:
Expand Down

0 comments on commit 5705efd

Please sign in to comment.