-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(airgap): Support scp files to node's data-dir
- Loading branch information
1 parent
8a3777b
commit e93e779
Showing
3 changed files
with
90 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package airgap | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGetDataPath(t *testing.T) { | ||
type testcase struct { | ||
name string | ||
args string | ||
expectPath string | ||
} | ||
for _, c := range []testcase{ | ||
{name: "no extra args", expectPath: defaultDataDirPath}, | ||
{name: "no data path args", args: "--bind-address=0.0.0.0", expectPath: defaultDataDirPath}, | ||
{name: "data dir args", args: "--data-dir /data", expectPath: "/data"}, | ||
{name: "data dir args with equal sign", args: "--data-dir=/data", expectPath: "/data"}, | ||
{name: "data dir args with short name", args: "-d /data", expectPath: "/data"}, | ||
{name: "data dir args with short name and equal sign", args: "-d=/data", expectPath: "/data"}, | ||
{name: "wrong data dir args", args: "--data-dir", expectPath: defaultDataDirPath}, | ||
} { | ||
path := getDataPath(c.args) | ||
assert.Equalf(t, c.expectPath, path, "test: %s failed", c.name) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters