Commit d609e41
Fix test logging output.
In version 1.0.0-1.6.0, our in-process non-binary test driver didn't
call go-plugin, and called log.SetOutput to control what got logged, to
avoid flooding test output with debug logs.
From version 1.6.0, the in-process non-binary test driver had the same
behavior, but we added an out-of-process binary test driver, which used
go-plugin, but had the provider in a separate process that sent its
stdout and stderr through Terraform. Terraform then, not the test
framework, was responsible for filtering the output.
With the introduction of our in-process binary test driver, however,
we're using go-plugin and Terraform isn't filtering log output for us.
In theory, the log.SetOutput call that was working for the in-process
non-binary test driver should've worked here, as well, and it sort of
did. The issue was that go-plugin calls log.SetOutput and sets it to
os.Stderr in plugin.Serve, which overrides our filter.
To get this behavior back, after every call to plugin.Serve, we override
the go-plugin log.SetOutput by calling our own again.
This also removes the helper/resource.logOutput function, replacing its
usage with helper/logging.SetOutput, which does the same thing. The only
difference should be that filtering on test name is no longer supported.
If we want to support that, we would need to plumb a testing.T through
to runProviderCommand, which involves updating a lot of code for
marginal gain; as far as I know, nobody actually uses the test name
filtering for logging, preferring instead to log everything and only run
the test they want logs for.1 parent f9ebc90 commit d609e41
2 files changed
+5
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
16 | 13 | | |
17 | 14 | | |
18 | | - | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
| |||
451 | 447 | | |
452 | 448 | | |
453 | 449 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | 450 | | |
498 | 451 | | |
499 | 452 | | |
| |||
526 | 479 | | |
527 | 480 | | |
528 | 481 | | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
| 482 | + | |
534 | 483 | | |
535 | 484 | | |
536 | 485 | | |
| |||
0 commit comments