Skip to content

Commit

Permalink
CreateOperation should only be implemented alongside ExistenceCheck (h…
Browse files Browse the repository at this point in the history
  • Loading branch information
maxb committed Feb 3, 2023
1 parent a158d33 commit b038be4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion path_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ then this plugin will use kubernetes.io/serviceaccount as the default issuer.
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: b.pathConfigWrite,
logical.CreateOperation: b.pathConfigWrite,
logical.ReadOperation: b.pathConfigRead,
},

Expand Down
22 changes: 11 additions & 11 deletions path_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestConfig_Read(t *testing.T) {
}

req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestConfig(t *testing.T) {
}

req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand All @@ -111,7 +111,7 @@ func TestConfig(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand All @@ -132,7 +132,7 @@ func TestConfig(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand All @@ -153,7 +153,7 @@ func TestConfig(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand Down Expand Up @@ -189,7 +189,7 @@ func TestConfig(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand Down Expand Up @@ -232,7 +232,7 @@ func TestConfig(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand Down Expand Up @@ -274,7 +274,7 @@ func TestConfig(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand Down Expand Up @@ -321,7 +321,7 @@ func TestConfig(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand Down Expand Up @@ -437,7 +437,7 @@ func TestConfig_LocalCaJWT(t *testing.T) {
}

req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: tc.config,
Expand Down Expand Up @@ -490,7 +490,7 @@ func TestConfig_LocalJWTRenewal(t *testing.T) {
"kubernetes_host": "host",
}
req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: configPath,
Storage: storage,
Data: data,
Expand Down
12 changes: 6 additions & 6 deletions path_login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func setupBackend(t *testing.T, config *testBackendConfig) (logical.Backend, log
}

req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: "config",
Storage: storage,
Data: data,
Expand Down Expand Up @@ -493,7 +493,7 @@ func TestLogin_ECDSA_PEM(t *testing.T) {
}

req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: "config",
Storage: storage,
Data: data,
Expand Down Expand Up @@ -884,7 +884,7 @@ func TestLoginIssValidation(t *testing.T) {
}

req := &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: "config",
Storage: storage,
Data: data,
Expand Down Expand Up @@ -921,7 +921,7 @@ func TestLoginIssValidation(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: "config",
Storage: storage,
Data: data,
Expand Down Expand Up @@ -963,7 +963,7 @@ func TestLoginIssValidation(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: "config",
Storage: storage,
Data: data,
Expand Down Expand Up @@ -1008,7 +1008,7 @@ func TestLoginIssValidation(t *testing.T) {
}

req = &logical.Request{
Operation: logical.CreateOperation,
Operation: logical.UpdateOperation,
Path: "config",
Storage: storage,
Data: data,
Expand Down

0 comments on commit b038be4

Please sign in to comment.