Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codegen: generate client resource test and Terraform acceptance test #216

Merged
merged 4 commits into from
Feb 9, 2024

Conversation

maksym-nazarenko
Copy link
Collaborator

This PR introduces templates and codegen binary CLI flags to generate resource test files.

The flow to generate all files would be:

  1. Generate MikroTik resource stub via downloading specs from remote RouterOS (Parse inspected console item definition #212)
  2. Adjust the generated file with proper struct field types and tags
  3. Generate client test with
    $ go run cmd/mikrotik-codegen/main.go mikrotik -src client/dns.go -test -name DnsRecord -dest client/dns_test.go
  4. Generate Terraform resource with
    $ go run cmd/mikrotik-codegen/main.go terraform -src client/dns.go -dest mikrotik/resource_dns_test.go
  5. Generate Terraform acceptance test
    $ go run cmd/mikrotik-codegen/main.go terraform -src client/dns.go -accTest -dest mikrotik/resource_dns_test.go

@maksym-nazarenko maksym-nazarenko added the enhancement New feature or request label Dec 7, 2023
@maksym-nazarenko maksym-nazarenko merged commit 689904c into ddelnano:master Feb 9, 2024
4 checks passed
@maksym-nazarenko maksym-nazarenko deleted the codegen/tests branch February 9, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants