Skip to content

Commit

Permalink
fix: update
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Aug 20, 2024
1 parent b8fb823 commit 291cdb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions revocation/crl/cache/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,10 @@ func (c *FileCache) Set(ctx context.Context, uri string, bundle *Bundle) error {
if err != nil {
return err

Check warning on line 116 in revocation/crl/cache/file.go

View check run for this annotation

Codecov / codecov/patch

revocation/crl/cache/file.go#L116

Added line #L116 was not covered by tests
}
defer tempFile.Close()

if err := saveTar(tempFile, bundle); err != nil {
return err

Check warning on line 119 in revocation/crl/cache/file.go

View check run for this annotation

Codecov / codecov/patch

revocation/crl/cache/file.go#L119

Added line #L119 was not covered by tests
}
tempFile.Close()

// rename is atomic on UNIX-like platforms
return os.Rename(tempFile.Name(), filepath.Join(c.root, fileName(uri)))
Expand Down
5 changes: 5 additions & 0 deletions revocation/crl/cache/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"math/big"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -92,6 +93,10 @@ func TestFileCache(t *testing.T) {
func TestNewFileCache(t *testing.T) {
tempDir := t.TempDir()
t.Run("without permission to create cache directory", func(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("skipping test on Windows")
}

if err := os.Chmod(tempDir, 0); err != nil {
t.Fatalf("failed to change permission: %v", err)
}
Expand Down

0 comments on commit 291cdb7

Please sign in to comment.