Skip to content

data_source_device: port wait_for to plugin framework#678

Merged
neinkeinkaffee merged 3 commits intomainfrom
gesa/device-datasource-waitfor
Apr 15, 2026
Merged

data_source_device: port wait_for to plugin framework#678
neinkeinkaffee merged 3 commits intomainfrom
gesa/device-datasource-waitfor

Conversation

@neinkeinkaffee
Copy link
Copy Markdown
Contributor

@neinkeinkaffee neinkeinkaffee commented Apr 7, 2026

This adds the retry logic for the device datasource reads which had been missed in the initial migration. It also moves to using filter parameters in the request instead of filtering the response.

Updates tailscale/corp#37224

Terraform acceptance test: https://github.com/tailscale/corp/actions/runs/24337213200/job/71057801192

@neinkeinkaffee neinkeinkaffee force-pushed the gesa/device-datasource-waitfor branch 4 times, most recently from a3d8fd8 to ed0d2e4 Compare April 8, 2026 09:12
@neinkeinkaffee neinkeinkaffee marked this pull request as ready for review April 8, 2026 09:12
@neinkeinkaffee neinkeinkaffee force-pushed the gesa/device-datasource-waitfor branch 2 times, most recently from c675fc0 to b65e061 Compare April 9, 2026 14:37
@neinkeinkaffee neinkeinkaffee changed the title data_source_device: port readWithWaitFor to plugin framework data_source_device: port wait_for to plugin framework Apr 9, 2026
@neinkeinkaffee neinkeinkaffee force-pushed the gesa/device-datasource-waitfor branch from b65e061 to 57a6673 Compare April 13, 2026 09:49
Comment thread tailscale/provider_test.go Outdated
},
})
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This unit test is tied to the unexported retryWithDeadline function and might not be worth keeping as long as we're fine with testing the retry logic in the device data source's unit test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we could also move retryWithDeadline directly into the device data source code alternatively since this is very specific to our device registration flow (and only used for the device data source) vs. a more generic retry mechanism at the moment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Absolutely!

@neinkeinkaffee neinkeinkaffee force-pushed the gesa/device-datasource-waitfor branch from 57a6673 to 35977ce Compare April 13, 2026 09:55
}

if len(devices) == 0 {
return errors.New("could not find device with" + filterDesc)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: should add a space here to make this more readable:

Suggested change
return errors.New("could not find device with" + filterDesc)
return errors.New("could not find device with " + filterDesc)

Copy link
Copy Markdown
Member

@mpminardi mpminardi left a comment

Choose a reason for hiding this comment

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

Apologies, my PR that adjusted one of the error messages in the device data source is now causing a conflict here (and the error source has been removed entirely now 🙈 ).

This adds the retry logic for the device datasource reads which
had been missed in the initial migration.

Updates tailscale.com/corp#37224

Signed-off-by: Gesa Stupperich <gesa@tailscale.com>
Updates tailscale.com/corp#37224

Signed-off-by: Gesa Stupperich <gesa@tailscale.com>
This is better to test against regressions during future refactorings
than testing the retry logic itself which is an implementation detail.

Updates tailscale.com/corp#37224

Signed-off-by: Gesa Stupperich <gesa@tailscale.com>
@neinkeinkaffee neinkeinkaffee force-pushed the gesa/device-datasource-waitfor branch from 35977ce to 2d8760e Compare April 15, 2026 06:55
@neinkeinkaffee neinkeinkaffee merged commit a1c0ec2 into main Apr 15, 2026
5 checks passed
@neinkeinkaffee neinkeinkaffee deleted the gesa/device-datasource-waitfor branch April 15, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants