mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
* Nest jobs under an organization * Rename project parameter to parameter schema * Update references when computing project parameters * Add files endpoint * Allow one-off project import jobs * Allow variables to be injected that are not defined by the schema * Update API to use jobs first * Fix CLI tests * Fix linting * Fix hex length for files table * Reduce memory allocation for windows
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package coderdtest_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"go.uber.org/goleak"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/coder/coder/coderd"
|
|
"github.com/coder/coder/coderd/coderdtest"
|
|
"github.com/coder/coder/database"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
goleak.VerifyTestMain(m)
|
|
}
|
|
|
|
func TestNew(t *testing.T) {
|
|
t.Parallel()
|
|
client := coderdtest.New(t)
|
|
user := coderdtest.CreateInitialUser(t, client)
|
|
closer := coderdtest.NewProvisionerDaemon(t, client)
|
|
job := coderdtest.CreateProjectImportProvisionerJob(t, client, user.Organization, nil)
|
|
coderdtest.AwaitProvisionerJob(t, client, user.Organization, job.ID)
|
|
project := coderdtest.CreateProject(t, client, user.Organization, job.ID)
|
|
workspace := coderdtest.CreateWorkspace(t, client, "me", project.ID)
|
|
history, err := client.CreateWorkspaceHistory(context.Background(), "me", workspace.Name, coderd.CreateWorkspaceHistoryRequest{
|
|
ProjectVersionID: project.ActiveVersionID,
|
|
Transition: database.WorkspaceTransitionStart,
|
|
})
|
|
require.NoError(t, err)
|
|
coderdtest.AwaitProvisionerJob(t, client, user.Organization, history.ProvisionJobID)
|
|
closer.Close()
|
|
}
|