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

Commit

Permalink
Fix gencerts permissions check in test; Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
placer14 committed Jul 20, 2019
1 parent f9ec2e6 commit 46d5dd8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/gencerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (x *GenerateCertificates) Execute(args []string) error {
}

// Create ssl directory
err = os.MkdirAll(path.Join(repoPath, "ssl"), os.ModePerm)
err = os.MkdirAll(path.Join(repoPath, "ssl"), 0755)
if err != nil {
log.Fatalf("Failed to create ssl directory: %s", err)
}
Expand Down
14 changes: 6 additions & 8 deletions cmd/gencerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ func buildCertDirectory() (string, func(), error) {

func TestGenCertsGenericDefaults(t *testing.T) {
dataDir, destroy, schemaErr := buildCertDirectory()
//defer destroy()

if schemaErr != nil {
destroy()
t.Fatal(schemaErr)
}
defer destroy()

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

args := []string{"args"} // "Commander" interface args
args := []string{""}

if err := config.Execute(args); err != nil {
t.Fatalf("unable to GenerateCertificates: %s", err)
Expand All @@ -51,8 +49,8 @@ func TestGenCertsGenericDefaults(t *testing.T) {
if errSsl != nil {
t.Fatalf("unable to find sslPath: %s", errSsl)
}
if fileInfoSsl.Mode().Perm() != 0775 {
t.Fatal("ssl directory does not have 0775 permissions")
if fileInfoSsl.Mode().Perm() != 0755 {
t.Fatal("ssl directory does not have 0755 permissions")
}
if !fileInfoSsl.IsDir() {
t.Fatalf("Expecting a directory: %s", dataDir)
Expand All @@ -63,8 +61,8 @@ func TestGenCertsGenericDefaults(t *testing.T) {
if errCert != nil {
t.Fatalf("unable to find certPemPath %s: %s", certPemPath, errCert)
}
if fileInfoCert.Mode().Perm() != 0664 {
t.Fatal("cert.pem does not have 0664 permissions")
if fileInfoCert.Mode().Perm() != 0644 {
t.Fatal("cert.pem does not have 0644 permissions")
}
if !fileInfoCert.Mode().IsRegular() {
t.Fatalf("Expecting a file: %s", certPemPath)
Expand Down

0 comments on commit 46d5dd8

Please sign in to comment.