mirror of
https://github.com/containers/podman.git
synced 2025-06-17 06:57:43 +08:00
refactor: improve get ssh path duplicate code
Signed-off-by: Black-Hole1 <bh@bugs.cc>
This commit is contained in:
@ -2,9 +2,11 @@ package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/containers/storage/pkg/homedir"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@ -56,6 +58,12 @@ func TestValidateSysctlBadSysctlWithExtraSpaces(t *testing.T) {
|
||||
assert.Equal(t, err.Error(), fmt.Sprintf(expectedError, strSlice2[1]))
|
||||
}
|
||||
|
||||
func TestGetIdentityPath(t *testing.T) {
|
||||
name := "p-test"
|
||||
identityPath := GetIdentityPath(name)
|
||||
assert.Equal(t, identityPath, filepath.Join(homedir.Get(), ".ssh", name))
|
||||
}
|
||||
|
||||
func TestCoresToPeriodAndQuota(t *testing.T) {
|
||||
cores := 1.0
|
||||
expectedPeriod := DefaultCPUPeriod
|
||||
|
Reference in New Issue
Block a user