Skip to content

Commit

Permalink
use temp file instead
Browse files Browse the repository at this point in the history
  • Loading branch information
kayra1 committed May 31, 2024
1 parent 7d46a3c commit c3f7e1d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"math/big"
"net/http"
"net/http/httptest"
"os"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -94,7 +95,14 @@ func initializeTestDB(t *testing.T, db *certdb.CertificateRequestsRepository) {

// TestMetrics tests some of the metrics that we currently collect.
func TestMetrics(t *testing.T) {
db, err := certdb.NewCertificateRequestsRepository(":memory:", "CertificateReq")
f, err := os.CreateTemp("./","*.db")
fmt.Print(f.Name())
if err != nil {
t.Fatal("couldn't create temp db file: "+ err.Error())
}
defer f.Close()
defer os.Remove(f.Name())
db, err := certdb.NewCertificateRequestsRepository(f.Name(), "CertificateReq")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit c3f7e1d

Please sign in to comment.