requireValidDatabaseUpdatedEventPayload checks the audit log output for at least one database updated event, and validates that each payload can be used validly
(rt *RestTester, output []byte)
| 684 | |
| 685 | // requireValidDatabaseUpdatedEventPayload checks the audit log output for at least one database updated event, and validates that each payload can be used validly |
| 686 | func requireValidDatabaseUpdatedEventPayload(rt *RestTester, output []byte) { |
| 687 | events := bytes.Split(output, []byte("\n")) |
| 688 | foundEvent := false |
| 689 | for _, rawEvent := range events { |
| 690 | if bytes.TrimSpace(rawEvent) == nil { |
| 691 | continue |
| 692 | } |
| 693 | var event struct { |
| 694 | ID base.AuditID `json:"id"` |
| 695 | Payload string `json:"payload"` |
| 696 | } |
| 697 | require.NoError(rt.TB(), base.JSONUnmarshal(rawEvent, &event)) |
| 698 | if event.ID != base.AuditIDUpdateDatabaseConfig { |
| 699 | continue |
| 700 | } |
| 701 | require.NotEmpty(rt.TB(), event.Payload) |
| 702 | RequireStatus(rt.TB(), rt.SendAdminRequest(http.MethodPost, "/{{.db}}/_config", event.Payload), http.StatusCreated) |
| 703 | foundEvent = true |
| 704 | } |
| 705 | require.True(rt.TB(), foundEvent, "expected audit event not found") |
| 706 | } |
| 707 | |
| 708 | func TestRedactConfigAsStr(t *testing.T) { |
| 709 | testCases := []struct { |
no test coverage detected