CreateDatabase is a utility function to create a database through the REST API
(dbName string, config DbConfig)
| 504 | |
| 505 | // CreateDatabase is a utility function to create a database through the REST API |
| 506 | func (rt *RestTester) CreateDatabase(dbName string, config DbConfig) (resp *TestResponse) { |
| 507 | dbcJSON, err := base.JSONMarshal(config) |
| 508 | require.NoError(rt.TB(), err) |
| 509 | if rt.AdminInterfaceAuthentication { |
| 510 | resp = rt.SendAdminRequestWithAuth(http.MethodPut, fmt.Sprintf("/%s/", dbName), string(dbcJSON), base.TestClusterUsername(), base.TestClusterPassword()) |
| 511 | } else { |
| 512 | resp = rt.SendAdminRequest(http.MethodPut, fmt.Sprintf("/%s/", dbName), string(dbcJSON)) |
| 513 | } |
| 514 | return resp |
| 515 | } |
| 516 | |
| 517 | // ReplaceDbConfig is a utility function to replace a database config through the REST API |
| 518 | func (rt *RestTester) ReplaceDbConfig(dbName string, config DbConfig) *TestResponse { |