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