1
1
package coderdtest_test
2
2
3
3
import (
4
+ "context"
4
5
"testing"
5
6
6
7
"go.uber.org/goleak"
7
8
9
+ "github.com/coder/coder/coderd"
8
10
"github.com/coder/coder/coderd/coderdtest"
11
+ "github.com/coder/coder/database"
12
+ "github.com/stretchr/testify/require"
9
13
)
10
14
11
15
func TestMain (m * testing.M ) {
@@ -15,6 +19,17 @@ func TestMain(m *testing.M) {
15
19
func TestNew (t * testing.T ) {
16
20
t .Parallel ()
17
21
client := coderdtest .New (t )
18
- _ = coderdtest .CreateInitialUser (t , client )
19
- _ = coderdtest .NewProvisionerDaemon (t , client )
22
+ user := coderdtest .CreateInitialUser (t , client )
23
+ closer := coderdtest .NewProvisionerDaemon (t , client )
24
+ project := coderdtest .CreateProject (t , client , user .Organization )
25
+ version := coderdtest .CreateProjectVersion (t , client , user .Organization , project .Name , nil )
26
+ coderdtest .AwaitProjectVersionImported (t , client , user .Organization , project .Name , version .Name )
27
+ workspace := coderdtest .CreateWorkspace (t , client , "me" , project .ID )
28
+ history , err := client .CreateWorkspaceHistory (context .Background (), "me" , workspace .Name , coderd.CreateWorkspaceHistoryRequest {
29
+ ProjectVersionID : version .ID ,
30
+ Transition : database .WorkspaceTransitionCreate ,
31
+ })
32
+ require .NoError (t , err )
33
+ coderdtest .AwaitWorkspaceHistoryProvisioned (t , client , "me" , workspace .Name , history .Name )
34
+ closer .Close ()
20
35
}
0 commit comments