|
| 1 | +package applesilicon |
| 2 | + |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | + |
| 6 | + "github.com/scaleway/scaleway-cli/internal/core" |
| 7 | +) |
| 8 | + |
| 9 | +func Test_ServerSSH(t *testing.T) { |
| 10 | + t.Run("Simple", core.Test(&core.TestConfig{ |
| 11 | + Commands: GetCommands(), |
| 12 | + BeforeFunc: core.BeforeFuncCombine( |
| 13 | + core.ExecStoreBeforeCmd("Server", "scw apple-silicon server create"), |
| 14 | + ), |
| 15 | + Cmd: "scw apple-silicon server ssh {{ .Server.ID }}", |
| 16 | + OverrideExec: core.OverrideExecSimple( |
| 17 | + "ssh {{ .Server.IP }} -p 22 -l m1 -t", |
| 18 | + 0, |
| 19 | + ), |
| 20 | + Check: core.TestCheckCombine( |
| 21 | + core.TestCheckGolden(), |
| 22 | + core.TestCheckExitCode(0), |
| 23 | + ), |
| 24 | + AfterFunc: core.AfterFuncCombine( |
| 25 | + core.ExecAfterCmd("scw apple-silicon server delete {{ .Server.ID }}"), |
| 26 | + ), |
| 27 | + DisableParallel: true, |
| 28 | + })) |
| 29 | + |
| 30 | + t.Run("With-Exit-Code", core.Test(&core.TestConfig{ |
| 31 | + Commands: GetCommands(), |
| 32 | + BeforeFunc: core.BeforeFuncCombine( |
| 33 | + core.ExecStoreBeforeCmd("Server", "scw apple-silicon server create"), |
| 34 | + ), |
| 35 | + Cmd: "scw apple-silicon server ssh {{ .Server.ID }}", |
| 36 | + OverrideExec: core.OverrideExecSimple( |
| 37 | + "ssh {{ .Server.IP }} -p 22 -l m1 -t", |
| 38 | + 130, |
| 39 | + ), |
| 40 | + Check: core.TestCheckCombine( |
| 41 | + core.TestCheckGolden(), |
| 42 | + core.TestCheckExitCode(130), |
| 43 | + ), |
| 44 | + AfterFunc: core.AfterFuncCombine( |
| 45 | + core.ExecAfterCmd("scw apple-silicon server delete {{ .Server.ID }}"), |
| 46 | + ), |
| 47 | + DisableParallel: true, |
| 48 | + })) |
| 49 | +} |
0 commit comments