|
1 | 1 | package integration
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - // "context" |
5 |
| - // "fmt" |
6 |
| - // "regexp" |
| 4 | + "context" |
| 5 | + "fmt" |
| 6 | + "regexp" |
7 | 7 | "testing"
|
8 |
| - //"cdr.dev/coder-cli/pkg/tcli" |
| 8 | + |
| 9 | + "cdr.dev/coder-cli/pkg/tcli" |
9 | 10 | )
|
10 | 11 |
|
11 | 12 | func TestSecrets(t *testing.T) {
|
12 |
| - // t.Parallel() |
13 |
| - // run(t, "secrets-cli-tests", func(t *testing.T, ctx context.Context, c *tcli.ContainerRunner) { |
14 |
| - // headlessLogin(ctx, t, c) |
| 13 | + run(t, "secrets-cli-tests", func(t *testing.T, ctx context.Context, c *tcli.ContainerRunner) { |
| 14 | + t.Skip() |
| 15 | + headlessLogin(ctx, t, c) |
15 | 16 |
|
16 |
| - // c.Run(ctx, "coder secrets ls").Assert(t, |
17 |
| - // tcli.Success(), |
18 |
| - // ) |
| 17 | + c.Run(ctx, "coder secrets ls").Assert(t, |
| 18 | + tcli.Success(), |
| 19 | + ) |
19 | 20 |
|
20 |
| - // name, value := randString(8), randString(8) |
| 21 | + name, value := randString(8), randString(8) |
21 | 22 |
|
22 |
| - // c.Run(ctx, "coder secrets create").Assert(t, |
23 |
| - // tcli.Error(), |
24 |
| - // ) |
| 23 | + c.Run(ctx, "coder secrets create").Assert(t, |
| 24 | + tcli.Error(), |
| 25 | + ) |
25 | 26 |
|
26 |
| - // // this tests the "Value:" prompt fallback |
27 |
| - // c.Run(ctx, fmt.Sprintf("echo %s | coder secrets create %s --from-prompt", value, name)).Assert(t, |
28 |
| - // tcli.Success(), |
29 |
| - // tcli.StderrEmpty(), |
30 |
| - // ) |
| 27 | + // this tests the "Value:" prompt fallback |
| 28 | + c.Run(ctx, fmt.Sprintf("echo %s | coder secrets create %s --from-prompt", value, name)).Assert(t, |
| 29 | + tcli.Success(), |
| 30 | + tcli.StderrEmpty(), |
| 31 | + ) |
31 | 32 |
|
32 |
| - // c.Run(ctx, "coder secrets ls").Assert(t, |
33 |
| - // tcli.Success(), |
34 |
| - // tcli.StderrEmpty(), |
35 |
| - // tcli.StdoutMatches("Value"), |
36 |
| - // tcli.StdoutMatches(regexp.QuoteMeta(name)), |
37 |
| - // ) |
| 33 | + c.Run(ctx, "coder secrets ls").Assert(t, |
| 34 | + tcli.Success(), |
| 35 | + tcli.StderrEmpty(), |
| 36 | + tcli.StdoutMatches("Value"), |
| 37 | + tcli.StdoutMatches(regexp.QuoteMeta(name)), |
| 38 | + ) |
38 | 39 |
|
39 |
| - // c.Run(ctx, "coder secrets view "+name).Assert(t, |
40 |
| - // tcli.Success(), |
41 |
| - // tcli.StderrEmpty(), |
42 |
| - // tcli.StdoutMatches(regexp.QuoteMeta(value)), |
43 |
| - // ) |
| 40 | + c.Run(ctx, "coder secrets view "+name).Assert(t, |
| 41 | + tcli.Success(), |
| 42 | + tcli.StderrEmpty(), |
| 43 | + tcli.StdoutMatches(regexp.QuoteMeta(value)), |
| 44 | + ) |
44 | 45 |
|
45 |
| - // c.Run(ctx, "coder secrets rm").Assert(t, |
46 |
| - // tcli.Error(), |
47 |
| - // ) |
48 |
| - // c.Run(ctx, "coder secrets rm "+name).Assert(t, |
49 |
| - // tcli.Success(), |
50 |
| - // ) |
51 |
| - // c.Run(ctx, "coder secrets view "+name).Assert(t, |
52 |
| - // tcli.Error(), |
53 |
| - // tcli.StdoutEmpty(), |
54 |
| - // ) |
| 46 | + c.Run(ctx, "coder secrets rm").Assert(t, |
| 47 | + tcli.Error(), |
| 48 | + ) |
| 49 | + c.Run(ctx, "coder secrets rm "+name).Assert(t, |
| 50 | + tcli.Success(), |
| 51 | + ) |
| 52 | + c.Run(ctx, "coder secrets view "+name).Assert(t, |
| 53 | + tcli.Error(), |
| 54 | + tcli.StdoutEmpty(), |
| 55 | + ) |
55 | 56 |
|
56 |
| - // name, value = randString(8), randString(8) |
| 57 | + name, value = randString(8), randString(8) |
57 | 58 |
|
58 |
| - // c.Run(ctx, fmt.Sprintf("coder secrets create %s --from-literal %s", name, value)).Assert(t, |
59 |
| - // tcli.Success(), |
60 |
| - // tcli.StderrEmpty(), |
61 |
| - // ) |
| 59 | + c.Run(ctx, fmt.Sprintf("coder secrets create %s --from-literal %s", name, value)).Assert(t, |
| 60 | + tcli.Success(), |
| 61 | + tcli.StderrEmpty(), |
| 62 | + ) |
62 | 63 |
|
63 |
| - // c.Run(ctx, "coder secrets view "+name).Assert(t, |
64 |
| - // tcli.Success(), |
65 |
| - // tcli.StdoutMatches(regexp.QuoteMeta(value)), |
66 |
| - // ) |
| 64 | + c.Run(ctx, "coder secrets view "+name).Assert(t, |
| 65 | + tcli.Success(), |
| 66 | + tcli.StdoutMatches(regexp.QuoteMeta(value)), |
| 67 | + ) |
67 | 68 |
|
68 |
| - // name, value = randString(8), randString(8) |
69 |
| - // c.Run(ctx, fmt.Sprintf("echo %s > ~/secret.json", value)).Assert(t, |
70 |
| - // tcli.Success(), |
71 |
| - // ) |
72 |
| - // c.Run(ctx, fmt.Sprintf("coder secrets create %s --from-file ~/secret.json", name)).Assert(t, |
73 |
| - // tcli.Success(), |
74 |
| - // ) |
75 |
| - // c.Run(ctx, "coder secrets view "+name).Assert(t, |
76 |
| - // tcli.Success(), |
77 |
| - // tcli.StdoutMatches(regexp.QuoteMeta(value)), |
78 |
| - // ) |
79 |
| - // }) |
| 69 | + name, value = randString(8), randString(8) |
| 70 | + c.Run(ctx, fmt.Sprintf("echo %s > ~/secret.json", value)).Assert(t, |
| 71 | + tcli.Success(), |
| 72 | + ) |
| 73 | + c.Run(ctx, fmt.Sprintf("coder secrets create %s --from-file ~/secret.json", name)).Assert(t, |
| 74 | + tcli.Success(), |
| 75 | + ) |
| 76 | + c.Run(ctx, "coder secrets view "+name).Assert(t, |
| 77 | + tcli.Success(), |
| 78 | + tcli.StdoutMatches(regexp.QuoteMeta(value)), |
| 79 | + ) |
| 80 | + }) |
80 | 81 | }
|
0 commit comments