fix lint
This commit is contained in:
parent
0bf7b63286
commit
b049c6a779
|
@ -44,8 +44,14 @@ func TestNewWriter(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_writer_WriteFile(t *testing.T) {
|
||||
deleteAllDirs()
|
||||
defer deleteAllDirs()
|
||||
err := deleteAllDirs()
|
||||
require.NoError(t, err)
|
||||
|
||||
defer func(t *testing.T) {
|
||||
err := deleteAllDirs()
|
||||
require.NoError(t, err)
|
||||
}(t)
|
||||
|
||||
w := newWriter(testWriterPath)
|
||||
wgot, err := w.WriteFile(testFileName, []byte(testFileContent))
|
||||
require.NoError(t, err)
|
||||
|
@ -57,18 +63,25 @@ func Test_writer_WriteFile(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_writer_WriteFileError(t *testing.T) {
|
||||
deleteAllDirs()
|
||||
defer deleteAllDirs()
|
||||
err := deleteAllDirs()
|
||||
require.NoError(t, err)
|
||||
|
||||
defer func(t *testing.T) {
|
||||
err := deleteAllDirs()
|
||||
require.NoError(t, err)
|
||||
}(t)
|
||||
|
||||
w := newWriter("")
|
||||
_, err := w.WriteFile(testFileName, []byte(testFileContent))
|
||||
_, err = w.WriteFile(testFileName, []byte(testFileContent))
|
||||
assert.Error(t, err)
|
||||
|
||||
w = newWriter(testWriterPath)
|
||||
_, err = w.WriteFile("", []byte(testFileContent))
|
||||
require.Error(t, err)
|
||||
|
||||
go func() {
|
||||
deleteAllDirs()
|
||||
go func(t *testing.T) {
|
||||
err := deleteAllDirs()
|
||||
require.NoError(t, err)
|
||||
for {
|
||||
f, err := os.Stat(testWriterPath)
|
||||
if err != nil {
|
||||
|
@ -83,7 +96,7 @@ func Test_writer_WriteFileError(t *testing.T) {
|
|||
require.NoError(t, err, "should not throw error because dir exists")
|
||||
return
|
||||
}
|
||||
}()
|
||||
}(t)
|
||||
|
||||
_, err = w.WriteFile(testFileName, nil)
|
||||
assert.Error(t, err)
|
||||
|
|
|
@ -29,8 +29,10 @@ type Subject struct {
|
|||
PostalCode string
|
||||
}
|
||||
|
||||
/*
|
||||
var (
|
||||
subjectKeyId = []byte{1, 2, 3, 4, 6}
|
||||
extKeyUsage = []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}
|
||||
keyUsage = x509.KeyUsageDigitalSignature
|
||||
)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue