- Created `qa-test-output-after-fix.txt` and `qa-test-output.txt` to log results of certificate page authentication tests. - Added `build.sh` for deterministic backend builds in CI, utilizing `go list` for efficiency. - Introduced `codeql_scan.sh` for CodeQL database creation and analysis for Go and JavaScript/TypeScript. - Implemented `dockerfile_check.sh` to validate Dockerfiles for base image and package manager mismatches. - Added `sourcery_precommit_wrapper.sh` to facilitate Sourcery CLI usage in pre-commit hooks.
36 lines
738 B
Go
36 lines
738 B
Go
package services
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestBackupService_GetAvailableSpace(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
t.Run("returns space for existing directory", func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tmpDir := t.TempDir()
|
|
svc := &BackupService{BackupDir: tmpDir}
|
|
|
|
space, err := svc.GetAvailableSpace()
|
|
require.NoError(t, err)
|
|
assert.Greater(t, space, int64(0))
|
|
})
|
|
|
|
t.Run("errors for missing directory", func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tmpDir := t.TempDir()
|
|
missingDir := filepath.Join(tmpDir, "does-not-exist")
|
|
svc := &BackupService{BackupDir: missingDir}
|
|
|
|
_, err := svc.GetAvailableSpace()
|
|
require.Error(t, err)
|
|
})
|
|
}
|