Skip to content

Commit

Permalink
fix: fix pem generator
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Sep 2, 2024
1 parent 9ce5683 commit 130983b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions internal/generator/certs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestGetCertConfig(t *testing.T) {

func TestGetGeneralExecuteCmds(t *testing.T) {
ret := generator.GetGeneralExecuteCmds(define.GENERATE_CMD_TPL, "abc")
if ret != "openssl req -x509 -newkey rsa:2048 -keyout /abc.key -out /abc.crt -days 3650 -nodes -config /abc.conf" {
if ret != "openssl req -x509 -newkey rsa:2048 -keyout /abc.pem.key -out /abc.pem.crt -days 3650 -nodes -config /abc.conf" {
t.Fatal("test GetGeneralExecuteCmds failed")
}
}
Expand All @@ -129,7 +129,7 @@ func TestMakeCerts(t *testing.T) {

fileGenerated := []string{
"./abc.com.conf",
"./abc.com.key",
"./abc.com.pem.key",
}

for _, file := range fileGenerated {
Expand All @@ -148,7 +148,7 @@ func TestMakeCerts(t *testing.T) {

fileGenerated = []string{
"./abc.com.k8s.conf",
"./abc.com.k8s.key",
"./abc.com.k8s.pem.key",
}
for _, file := range fileGenerated {
if _, err := os.Stat(file); errors.Is(err, os.ErrNotExist) {
Expand All @@ -167,7 +167,7 @@ func TestMakeCerts(t *testing.T) {

fileGenerated = []string{
"./abc.com.conf",
"./abc.com.key",
"./abc.com.pem.key",
"./abc.com.rootCA.key",
}
for _, file := range fileGenerated {
Expand Down
2 changes: 1 addition & 1 deletion internal/generator/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestGenerate(t *testing.T) {

generator.Generate()

if _, err := os.Stat("./abc.com.key"); errors.Is(err, os.ErrNotExist) {
if _, err := os.Stat("./abc.com.pem.key"); errors.Is(err, os.ErrNotExist) {
t.Fatal("test MakeCerts failed")
}
os.Remove("./abc.com.key")
Expand Down

0 comments on commit 130983b

Please sign in to comment.