Skip to content

TPT-4576: add 'When' field to AccountMaintenance struct - #1015

Merged
zliang-akamai merged 3 commits into
linode:mainfrom
zliang-akamai:zhiwei/account-maintenance-add-when
Jul 29, 2026
Merged

TPT-4576: add 'When' field to AccountMaintenance struct#1015
zliang-akamai merged 3 commits into
linode:mainfrom
zliang-akamai:zhiwei/account-maintenance-add-when

Conversation

@zliang-akamai

Copy link
Copy Markdown
Member

📝 Description

Add When back in AccountMaintenance.

✔️ How to Test

Unit testing only, see CI for the result.

Copilot AI review requested due to automatic review settings July 28, 2026 19:05
@zliang-akamai
zliang-akamai requested review from a team as code owners July 28, 2026 19:05
@zliang-akamai
zliang-akamai requested review from jriddle-linode and mawilk90 and removed request for a team July 28, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reintroduces the When timestamp on AccountMaintenance responses, ensuring the client can parse the API’s when field and that unit fixtures/tests validate the behavior.

Changes:

  • Added When *time.Time to AccountMaintenance and wired it into the custom UnmarshalJSON.
  • Updated the unit fixture JSON to include the when field for each maintenance record.
  • Extended the unit test to assert When is present and correctly parsed.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
account_maintenance.go Adds When and parses it from the API payload via parseabletime.
test/unit/fixtures/account_maintenance_list.json Adds when values to fixture data used by unit tests.
test/unit/account_maintenance_test.go Validates When is unmarshaled and matches expected RFC3339 timestamps.
Comments suppressed due to low confidence (1)

test/unit/account_maintenance_test.go:58

  • assert.NotNil does not stop the test, so maintenances[1].When.Format(...) can still panic if When is nil. Guard the Format call (or switch to require.NotNil).
	assert.NotNil(t, maintenances[1].When)
	assert.Equal(t, "2025-03-25T11:00:00Z", maintenances[1].When.Format(time.RFC3339))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/unit/account_maintenance_test.go Outdated
@zliang-akamai
zliang-akamai force-pushed the zhiwei/account-maintenance-add-when branch from 8b58fde to 792c2c4 Compare July 28, 2026 19:17
@zliang-akamai
zliang-akamai merged commit 7fca9eb into linode:main Jul 29, 2026
10 checks passed
@yec-akamai yec-akamai added the new-feature for new features in the changelog. label Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants