mirror of
https://github.com/1f349/orchid.git
synced 2024-12-22 08:04:10 +00:00
Use insecure directory certificate for tests
This commit is contained in:
parent
d300424706
commit
bfdcb07613
@ -17,11 +17,9 @@ import (
|
|||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"go/build"
|
"go/build"
|
||||||
"io"
|
|
||||||
"log"
|
"log"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -106,15 +104,6 @@ func setupPebbleTest(t *testing.T, serverTls *certgen.CertGen) *Service {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
log.Println("DB File:", dbFile)
|
log.Println("DB File:", dbFile)
|
||||||
|
|
||||||
tr := http.DefaultTransport.(*http.Transport).Clone()
|
|
||||||
tr.TLSClientConfig.InsecureSkipVerify = true
|
|
||||||
req, err := http.NewRequest(http.MethodGet, "https://localhost:14000/root", nil)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
res, err := tr.RoundTrip(req)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
certRaw, err := io.ReadAll(res.Body)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
certDir, err := os.MkdirTemp("", "orchid-certs")
|
certDir, err := os.MkdirTemp("", "orchid-certs")
|
||||||
keyDir, err := os.MkdirTemp("", "orchid-keys")
|
keyDir, err := os.MkdirTemp("", "orchid-keys")
|
||||||
|
|
||||||
@ -128,7 +117,7 @@ func setupPebbleTest(t *testing.T, serverTls *certgen.CertGen) *Service {
|
|||||||
PrivateKey: string(pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(lePrivKey)})),
|
PrivateKey: string(pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(lePrivKey)})),
|
||||||
},
|
},
|
||||||
Directory: "https://localhost:14000/dir",
|
Directory: "https://localhost:14000/dir",
|
||||||
Certificate: string(certRaw),
|
Certificate: "insecure",
|
||||||
insecure: true,
|
insecure: true,
|
||||||
}, certDir, keyDir)
|
}, certDir, keyDir)
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user