Aclp logs support#963
Open
klipensk wants to merge 18 commits into
Open
Conversation
…sue with always serialized storage key and secret - now test logs destination tests will always pass also in recording mode
…pi.linode fixtures
# Conflicts: # test/integration/fixtures/TestLogsDestination_Create_InvalidSecret.yaml # test/integration/fixtures/TestLogsDestination_Create_InvalidType.yaml # test/integration/fixtures/TestLogsDestination_Delete.yaml # test/integration/fixtures/TestLogsDestination_Get.yaml # test/integration/fixtures/TestLogsDestination_List.yaml # test/integration/fixtures/TestLogsDestination_UpdateAndHistory.yaml
Dps 42279 aclp logs stream api
…event input run_aclp_logs_stream_tests
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds first-class linodego SDK support for the ACLP Monitor Logs API, covering both Logs Destinations (monitor/streams/destinations) and Logs Streams (monitor/streams), along with unit + integration test coverage and CI wiring for optionally running long-running stream tests.
Changes:
- Introduces new SDK types and client methods for Logs Destinations and Logs Streams, including history endpoints and time parsing.
- Adds comprehensive unit tests and JSON fixtures for destinations and streams (including LKE audit log stream details).
- Adds integration tests + go-vcr cassettes for destinations/streams and updates CI to allow opting into stream tests via
RUN_ACLP_LOGS_STREAM_TESTS.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
monitor_log_destinations.go |
Implements Logs Destination models and CRUD/history client methods. |
monitor_log_streams.go |
Implements Logs Stream models and CRUD/history client methods. |
test/unit/monitor_logs_test.go |
Adds unit tests for destinations, streams, and stream type constants. |
test/unit/fixtures/monitor_log_destinations_get.json |
Unit fixture for fetching a destination. |
test/unit/fixtures/monitor_log_destinations_list.json |
Unit fixture for listing destinations (including custom_https). |
test/unit/fixtures/monitor_log_destinations_history_list.json |
Unit fixture for destination history listing. |
test/unit/fixtures/monitor_log_destinations_custom_https_get.json |
Unit fixture for custom_https destination fetch. |
test/unit/fixtures/monitor_log_stream.json |
Unit fixture for fetching a stream (audit_logs). |
test/unit/fixtures/monitor_log_streams_list.json |
Unit fixture for listing streams. |
test/unit/fixtures/monitor_log_streams_history.json |
Unit fixture for stream history listing. |
test/unit/fixtures/monitor_log_stream_lke.json |
Unit fixture for fetching an LKE audit log stream (details block). |
test/integration/monitor_logs_test.go |
Adds integration coverage for destination + stream lifecycle, with long provisioning safeguards. |
test/integration/integration_suite_test.go |
Adjusts go-vcr sanitization behavior to keep credentials usable during recording. |
.github/workflows/ci.yml |
Adds workflow_dispatch input and exports RUN_ACLP_LOGS_STREAM_TESTS to test runs. |
test/integration/fixtures/TestLogsDestination_List.yaml |
VCR cassette for listing destinations. |
test/integration/fixtures/TestLogsDestination_Get.yaml |
VCR cassette for getting a destination. |
test/integration/fixtures/TestLogsDestination_Delete.yaml |
VCR cassette for deleting a destination and cleaning up Object Storage. |
test/integration/fixtures/TestLogsDestination_UpdateAndHistory.yaml |
VCR cassette for updating a destination and validating history. |
test/integration/fixtures/TestLogsDestination_Create_InvalidSecret.yaml |
VCR cassette for invalid destination secret error case. |
test/integration/fixtures/TestLogsDestination_Create_InvalidType.yaml |
VCR cassette for invalid destination type error case. |
test/integration/fixtures/TestLogStream_Create_InvalidDestination.yaml |
VCR cassette for invalid destination stream create error case. |
test/integration/fixtures/TestLogStream_Create_EmptyDestinations.yaml |
VCR cassette for empty destinations stream create error case. |
test/integration/fixtures/TestLogStream_Create_TwoDestinations.yaml |
VCR cassette for multi-destination stream create error case. |
test/integration/fixtures/TestLogStream_Delete.yaml |
VCR cassette for stream delete flow. |
test/integration/fixtures/TestLogStream_List.yaml |
VCR cassette for stream list flow. |
test/integration/fixtures/TestLogStream_Get.yaml |
VCR cassette for stream get flow. |
test/integration/fixtures/TestLogStream_Update_LabelAndStatus.yaml |
VCR cassette for stream label/status update and history validation. |
test/integration/fixtures/TestLogStream_Update_Destinations.yaml |
VCR cassette for stream destination update and history validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
116
to
128
| r.AddSaveFilter(func(i *cassette.Interaction) error { | ||
| re := regexp.MustCompile("AWSAccessKeyId=[[:alnum:]]{20}") | ||
| // Sanitize credentials only when saving to cassette, so that real access/secret | ||
| // keys are available to test code during recording (e.g. for creating a | ||
| // LogsDestination that requires valid object-storage credentials). | ||
| re := regexp.MustCompile(`"access_key": "[[:alnum:]]*"`) | ||
| i.Response.Body = re.ReplaceAllString(i.Response.Body, `"access_key": "[SANITIZED]"`) | ||
| re = regexp.MustCompile(`"secret_key": "[[:alnum:]]*"`) | ||
| i.Response.Body = re.ReplaceAllString(i.Response.Body, `"secret_key": "[SANITIZED]"`) | ||
|
|
||
| re = regexp.MustCompile("AWSAccessKeyId=[[:alnum:]]{20}") | ||
| i.Response.Body = re.ReplaceAllString(i.Response.Body, "AWSAccessKeyID=SANITIZED") | ||
| i.Request.URL = re.ReplaceAllString(i.Request.URL, "AWSAccessKeyID=SANITIZED") | ||
| return nil |
Comment on lines
+532
to
+534
| - request: | ||
| body: '{"label":"go-test-logs-monitoring-1778509553204727000","type":"akamai_object_storage","details":{"access_key_id":"8I1CNGBK5HMRA19RGGY6","access_key_secret":"zHkpzPuAJFyIQjZgRdJz39EW8NVRwiDPsBCMd3Uw","bucket_name":"go-test-logs-monitoring-1778509545074390000","host":"go-test-logs-monitoring-1778509545074390000.gb-lon-1.linodeobjects.com"}}' | ||
| form: {} |
Comment on lines
+87
to
+94
| res, err := http.DefaultClient.Do(req) | ||
| if err != nil { | ||
| t.Errorf("failed to delete object: %s", err) | ||
| continue | ||
| } | ||
| if res.StatusCode != 204 { | ||
| t.Errorf("expected status code to be 204; got %d", res.StatusCode) | ||
| } |
Comment on lines
+116
to
+130
| dest, err := client.CreateLogsDestination(context.Background(), linodego.LogsDestinationCreateOptions{ | ||
| Label: testLabel(), | ||
| Type: linodego.LogsDestinationTypeAkamaiObjectStorage, | ||
| Details: linodego.LogsDestinationDetailsCreateOptions{ | ||
| AccessKeyID: storageKey.AccessKey, | ||
| AccessKeySecret: storageKey.SecretKey, | ||
| BucketName: bucket.Label, | ||
| Host: bucket.Hostname, | ||
| }, | ||
| }) | ||
| if err != nil { | ||
| storageTeardown() | ||
| fixtureTeardown() | ||
| t.Fatalf("Error creating logs destination, got error %v", err) | ||
| } |
…event input run_aclp_logs_stream_tests to integration tests pr yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
What does this PR do and why is this change necessary?
github workflow files were updated to include the run_aclp_logs_stream_tests environment variable.
✔️ How to Test
What are the steps to reproduce the issue or verify the changes?
How do I run the relevant unit/integration tests?