| 735 | } |
| 736 | |
| 737 | func (c *ProvisionerdCloser) Close() error { |
| 738 | c.mu.Lock() |
| 739 | defer c.mu.Unlock() |
| 740 | if c.closed { |
| 741 | return nil |
| 742 | } |
| 743 | c.closed = true |
| 744 | ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort) |
| 745 | defer cancel() |
| 746 | shutdownErr := c.d.Shutdown(ctx, true) |
| 747 | closeErr := c.d.Close() |
| 748 | if shutdownErr != nil { |
| 749 | return shutdownErr |
| 750 | } |
| 751 | return closeErr |
| 752 | } |
| 753 | |
| 754 | // NewProvisionerDaemon launches a provisionerd instance configured to work |
| 755 | // well with coderd testing. It registers the "echo" provisioner for |