-
Notifications
You must be signed in to change notification settings - Fork 44
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
Rapid generator for schema-value pairs #1801
Conversation
I'm assuming that this isn't relevant: pulumi-terraform-bridge/pkg/tfbridge/schema.go Lines 1001 to 1025 in cff9ca4
That's painful. Instead of batching, are we missing calls to
This seems like a good problem to address in the next PR. |
2d11361
to
2c76216
Compare
6 seconds per test is about right, why would you expect it to be faster? it's shelling out to tf and pulumi CLI and setting up folders and such. Looks like rapid does not support parallel exploration of the space. At least I didn't find it. We'd definitely want to batch evaluations over a map of resource instances and shrink it to the failing one. I've got some simple diff x-tests passing but still iterating to add more of different kinds of generators. Already yielding first very interesting bugs in the tracker. |
c1c3032
to
15521f7
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1801 +/- ##
==========================================
- Coverage 61.04% 60.18% -0.87%
==========================================
Files 303 319 +16
Lines 42442 43832 +1390
==========================================
+ Hits 25910 26380 +470
- Misses 15061 15964 +903
- Partials 1471 1488 +17 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pushing this!
pkg/tests/cross-tests/rapid_test.go
Outdated
|
||
rapid.Check(outerT, func(t *rapid.T) { | ||
outerT.Logf("Iterating..") | ||
tv := tvg.GenBlock(3).Draw(t, "tv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking if we should start with depth 1 as potentially easier to fix and then expand from there. Looks like most of the failures so far are at depth >=2.
Would that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, the depth shouldn't be fixed but should enable shrinking. I'll look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had success with rapid by interpreting the 3 as a depth cap (but not an explicit depth), setting the depth cap to 5 and then letting rapid optimize from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to check this in with an example of how to use the rapid generator. I want to make sure people can discover how to use these.
pkg/tests/cross-tests/rapid_test.go
Outdated
|
||
rapid.Check(outerT, func(t *rapid.T) { | ||
outerT.Logf("Iterating..") | ||
tv := tvg.GenBlock(3).Draw(t, "tv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had success with rapid by interpreting the 3 as a depth cap (but not an explicit depth), setting the depth cap to 5 and then letting rapid optimize from there.
@iwahbe the example is https://github.com/pulumi/pulumi-terraform-bridge/blob/t0yv0%2Ftv-generators/pkg/tests/cross-tests/rapid_test.go#L30 although it does not quite yet pass. Once you have a test that you can parameterize by "any schema and value of that schema" you can hook it up to rapid to start tearing through. |
Fixes #1790 by building a rapid generator for schemas and associated values.
Large-ish problem 1: I do not have it figured out how to test unknown values. TF literals as unknown values are forbidden and do not make sense. We might need a helper resource so that testing unknown values generates references to an output of the helper resource. This is logged for future work.
Large-ish problem 2: iteration is pretty slow (x-proc). Normal n=100 rapid tests can take up to 10min. Could try batching so several resources are tried in one shot say 100 resources.
Large-ish problem 3: I'm not sure if no-op Update and Create implementations are acceptable. There is something to testing Computed attributes where provider has to set values. Possibly Update also needs to set values? Possibly not.
Small problems:
We are starting to find bugs and discrepancies from this work:
Future work: