Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 6751fa8

Browse files
committed
fixup! Add integration tests for Secrets commands
1 parent 85d5289 commit 6751fa8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ci/integration/integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ func TestSecrets(t *testing.T) {
112112

113113
name, value := randString(8), randString(8)
114114

115-
c.Run(ctx, "coder secrets add").Assert(t,
115+
c.Run(ctx, "coder secrets create").Assert(t,
116116
tcli.Error(),
117117
tcli.StdoutEmpty(),
118118
tcli.StderrMatches("required flag"),
119119
)
120120

121-
c.Run(ctx, fmt.Sprintf("coder secrets add --name %s --value %s", name, value)).Assert(t,
121+
c.Run(ctx, fmt.Sprintf("coder secrets create --name %s --value %s", name, value)).Assert(t,
122122
tcli.Success(),
123123
tcli.StderrEmpty(),
124124
)

cmd/coder/secrets.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var (
2020
_ cli.ParentCommand = secretsCmd{}
2121

2222
_ cli.FlaggedCommand = &listSecretsCmd{}
23-
_ cli.FlaggedCommand = &addSecretCmd{}
23+
_ cli.FlaggedCommand = &createSecretCmd{}
2424
)
2525

2626
type secretsCmd struct {
@@ -44,7 +44,7 @@ func (cmd secretsCmd) Subcommands() []cli.Command {
4444
return []cli.Command{
4545
&listSecretsCmd{},
4646
&viewSecretsCmd{},
47-
&addSecretCmd{},
47+
&createSecretCmd{},
4848
&deleteSecretsCmd{},
4949
}
5050
}
@@ -110,11 +110,11 @@ func (cmd viewSecretsCmd) Run(fl *pflag.FlagSet) {
110110
requireSuccess(err, "failed to write: %v", err)
111111
}
112112

113-
type addSecretCmd struct {
113+
type createSecretCmd struct {
114114
name, value, description string
115115
}
116116

117-
func (cmd *addSecretCmd) Validate() (e []error) {
117+
func (cmd *createSecretCmd) Validate() (e []error) {
118118
if cmd.name == "" {
119119
e = append(e, xerrors.New("--name is a required flag"))
120120
}
@@ -124,15 +124,15 @@ func (cmd *addSecretCmd) Validate() (e []error) {
124124
return e
125125
}
126126

127-
func (cmd *addSecretCmd) Spec() cli.CommandSpec {
127+
func (cmd *createSecretCmd) Spec() cli.CommandSpec {
128128
return cli.CommandSpec{
129-
Name: "add",
129+
Name: "create",
130130
Usage: `--name MYSQL_KEY --value 123456 --description "MySQL credential for database access"`,
131131
Desc: "insert a new secret",
132132
}
133133
}
134134

135-
func (cmd *addSecretCmd) Run(fl *pflag.FlagSet) {
135+
func (cmd *createSecretCmd) Run(fl *pflag.FlagSet) {
136136
var (
137137
client = requireAuth()
138138
)
@@ -146,7 +146,7 @@ func (cmd *addSecretCmd) Run(fl *pflag.FlagSet) {
146146
requireSuccess(err, "failed to insert secret: %v", err)
147147
}
148148

149-
func (cmd *addSecretCmd) RegisterFlags(fl *pflag.FlagSet) {
149+
func (cmd *createSecretCmd) RegisterFlags(fl *pflag.FlagSet) {
150150
fl.StringVar(&cmd.name, "name", "", "the name of the secret")
151151
fl.StringVar(&cmd.value, "value", "", "the value of the secret")
152152
fl.StringVar(&cmd.description, "description", "", "a description of the secret")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy