Skip to content

Commit

Permalink
use t.TempDir()
Browse files Browse the repository at this point in the history
  • Loading branch information
phm07 committed Jan 2, 2025
1 parent c869349 commit d714f9a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/e2e/certificate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@ func TestCertificate(t *testing.T) {
t.Parallel()

t.Run("uploaded", func(t *testing.T) {
tmpDir, err := os.MkdirTemp(os.TempDir(), "hcloud-certificate-test")
defer func() {
_ = os.RemoveAll(tmpDir)
}()

tmpDir := t.TempDir()
notBefore := time.Now()
notAfter := notBefore.Add(365 * 24 * time.Hour)
certPath, keyPath := path.Join(tmpDir, "cert.pem"), path.Join(tmpDir, "key.pem")
fingerprint := ""
err = generateCertificate(certPath, keyPath, &fingerprint, notBefore, notAfter)
err := generateCertificate(certPath, keyPath, &fingerprint, notBefore, notAfter)
require.NoError(t, err)

certName := withSuffix("test-certificate-uploaded")
Expand Down

0 comments on commit d714f9a

Please sign in to comment.