mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	Pass context to backends (#3750)
* Start work on passing context to backends * More work on passing context * Unindent logical system * Unindent token store * Unindent passthrough * Unindent cubbyhole * Fix tests * use requestContext in rollback and expiration managers
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| package postgresql | ||||
|  | ||||
| import ( | ||||
| 	"context" | ||||
| 	"database/sql" | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| @@ -39,7 +40,7 @@ func prepareTestContainer(t *testing.T, s logical.Storage, b logical.Backend) (c | ||||
|  | ||||
| 	cid, connErr := dockertest.ConnectToPostgreSQL(60, 500*time.Millisecond, func(connURL string) bool { | ||||
| 		// This will cause a validation to run | ||||
| 		resp, err := b.HandleRequest(&logical.Request{ | ||||
| 		resp, err := b.HandleRequest(context.Background(), &logical.Request{ | ||||
| 			Storage:   s, | ||||
| 			Operation: logical.UpdateOperation, | ||||
| 			Path:      "config/connection", | ||||
| @@ -97,13 +98,13 @@ func TestBackend_config_connection(t *testing.T) { | ||||
| 		Storage:   config.StorageView, | ||||
| 		Data:      configData, | ||||
| 	} | ||||
| 	resp, err = b.HandleRequest(configReq) | ||||
| 	resp, err = b.HandleRequest(context.Background(), configReq) | ||||
| 	if err != nil || (resp != nil && resp.IsError()) { | ||||
| 		t.Fatalf("err:%s resp:%#v\n", err, resp) | ||||
| 	} | ||||
|  | ||||
| 	configReq.Operation = logical.ReadOperation | ||||
| 	resp, err = b.HandleRequest(configReq) | ||||
| 	resp, err = b.HandleRequest(context.Background(), configReq) | ||||
| 	if err != nil || (resp != nil && resp.IsError()) { | ||||
| 		t.Fatalf("err:%s resp:%#v\n", err, resp) | ||||
| 	} | ||||
| @@ -379,7 +380,7 @@ func testAccStepReadCreds(t *testing.T, b logical.Backend, s logical.Storage, na | ||||
| 				t.Fatalf("did not get expected number of rows, got %d", userRows) | ||||
| 			} | ||||
|  | ||||
| 			resp, err = b.HandleRequest(&logical.Request{ | ||||
| 			resp, err = b.HandleRequest(context.Background(), &logical.Request{ | ||||
| 				Operation: logical.RevokeOperation, | ||||
| 				Storage:   s, | ||||
| 				Secret: &logical.Secret{ | ||||
| @@ -441,7 +442,7 @@ func testAccStepCreateTable(t *testing.T, b logical.Backend, s logical.Storage, | ||||
| 				t.Fatal(err) | ||||
| 			} | ||||
|  | ||||
| 			resp, err = b.HandleRequest(&logical.Request{ | ||||
| 			resp, err = b.HandleRequest(context.Background(), &logical.Request{ | ||||
| 				Operation: logical.RevokeOperation, | ||||
| 				Storage:   s, | ||||
| 				Secret: &logical.Secret{ | ||||
| @@ -496,7 +497,7 @@ func testAccStepDropTable(t *testing.T, b logical.Backend, s logical.Storage, na | ||||
| 				t.Fatal(err) | ||||
| 			} | ||||
|  | ||||
| 			resp, err = b.HandleRequest(&logical.Request{ | ||||
| 			resp, err = b.HandleRequest(context.Background(), &logical.Request{ | ||||
| 				Operation: logical.RevokeOperation, | ||||
| 				Storage:   s, | ||||
| 				Secret: &logical.Secret{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Brian Kassouf
					Brian Kassouf