(t *testing.T)
| 477 | } |
| 478 | |
| 479 | func TestAdminAPIAuth(t *testing.T) { |
| 480 | base.LongRunningTest(t) |
| 481 | |
| 482 | // Don't really care about the log level but this test hits the logging endpoint so this is used to reset the logging |
| 483 | base.SetUpTestLogging(t, base.LevelInfo, base.KeyNone) |
| 484 | |
| 485 | if base.UnitTestUrlIsWalrus() { |
| 486 | t.Skip("This test only works against Couchbase Server") |
| 487 | } |
| 488 | serverURL := base.UnitTestUrl() |
| 489 | if base.ServerIsTLS(serverURL) { |
| 490 | t.Skipf("URI %s can not start with couchbases://", serverURL) |
| 491 | } |
| 492 | |
| 493 | rt := NewRestTester(t, &RestTesterConfig{ |
| 494 | AdminInterfaceAuthentication: true, |
| 495 | metricsInterfaceAuthentication: true, |
| 496 | }) |
| 497 | defer rt.Close() |
| 498 | |
| 499 | // init RT bucket so we can get the config |
| 500 | _ = rt.Bucket() |
| 501 | dbConfig := rt.DatabaseConfig |
| 502 | dbConfigRaw, err := base.JSONMarshal(dbConfig) |
| 503 | require.NoError(t, err) |
| 504 | |
| 505 | endPoints := []struct { |
| 506 | Method string |
| 507 | Endpoint string |
| 508 | SkipSuccessTest bool |
| 509 | body string // The body to use in requests. Default: `{}` |
| 510 | }{ |
| 511 | { |
| 512 | Method: "POST", |
| 513 | Endpoint: "/{{.db}}/_session", |
| 514 | }, |
| 515 | { |
| 516 | Method: "GET", |
| 517 | Endpoint: "/{{.db}}/_session/id", |
| 518 | }, |
| 519 | { |
| 520 | Method: "DELETE", |
| 521 | Endpoint: "/{{.db}}/_session/id", |
| 522 | }, |
| 523 | { |
| 524 | Method: "GET", |
| 525 | Endpoint: "/{{.keyspace}}/_raw/doc", |
| 526 | }, |
| 527 | { |
| 528 | Method: "GET", |
| 529 | Endpoint: "/{{.db}}/_user/", |
| 530 | }, |
| 531 | { |
| 532 | Method: "POST", |
| 533 | Endpoint: "/{{.db}}/_user/", |
| 534 | }, |
| 535 | { |
| 536 | Method: "GET", |
nothing calls this directly
no test coverage detected