Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 46d5dd8

Browse files
committed
Fix gencerts permissions check in test; Fix review comments
1 parent f9ec2e6 commit 46d5dd8

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

cmd/gencerts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (x *GenerateCertificates) Execute(args []string) error {
100100
}
101101

102102
// Create ssl directory
103-
err = os.MkdirAll(path.Join(repoPath, "ssl"), os.ModePerm)
103+
err = os.MkdirAll(path.Join(repoPath, "ssl"), 0755)
104104
if err != nil {
105105
log.Fatalf("Failed to create ssl directory: %s", err)
106106
}

cmd/gencerts_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ func buildCertDirectory() (string, func(), error) {
2626

2727
func TestGenCertsGenericDefaults(t *testing.T) {
2828
dataDir, destroy, schemaErr := buildCertDirectory()
29-
//defer destroy()
30-
3129
if schemaErr != nil {
32-
destroy()
3330
t.Fatal(schemaErr)
3431
}
32+
defer destroy()
3533

3634
config := cmd.GenerateCertificates{
3735
DataDir: dataDir,
@@ -40,7 +38,7 @@ func TestGenCertsGenericDefaults(t *testing.T) {
4038
ValidFor: 1, // 1ns ... 1*1e9 == 1s
4139
}
4240

43-
args := []string{"args"} // "Commander" interface args
41+
args := []string{""}
4442

4543
if err := config.Execute(args); err != nil {
4644
t.Fatalf("unable to GenerateCertificates: %s", err)
@@ -51,8 +49,8 @@ func TestGenCertsGenericDefaults(t *testing.T) {
5149
if errSsl != nil {
5250
t.Fatalf("unable to find sslPath: %s", errSsl)
5351
}
54-
if fileInfoSsl.Mode().Perm() != 0775 {
55-
t.Fatal("ssl directory does not have 0775 permissions")
52+
if fileInfoSsl.Mode().Perm() != 0755 {
53+
t.Fatal("ssl directory does not have 0755 permissions")
5654
}
5755
if !fileInfoSsl.IsDir() {
5856
t.Fatalf("Expecting a directory: %s", dataDir)
@@ -63,8 +61,8 @@ func TestGenCertsGenericDefaults(t *testing.T) {
6361
if errCert != nil {
6462
t.Fatalf("unable to find certPemPath %s: %s", certPemPath, errCert)
6563
}
66-
if fileInfoCert.Mode().Perm() != 0664 {
67-
t.Fatal("cert.pem does not have 0664 permissions")
64+
if fileInfoCert.Mode().Perm() != 0644 {
65+
t.Fatal("cert.pem does not have 0644 permissions")
6866
}
6967
if !fileInfoCert.Mode().IsRegular() {
7068
t.Fatalf("Expecting a file: %s", certPemPath)

0 commit comments

Comments
 (0)