@@ -57,15 +57,19 @@ func TestIntegration(t *testing.T) {
5757require .NoError (t , err , "invalid value specified for timeout" )
5858ctx , cancel := context .WithTimeout (context .Background (), time .Duration (timeoutMins )* time .Minute )
5959t .Cleanup (cancel )
60+ ctrID := setup (ctx , t , t .Name (), coderImg , coderVersion )
6061
6162for _ , tt := range []struct {
6263// Name of the folder under `integration/` containing a test template
6364name string
65+ // Minimum coder version for which to run this test
66+ minVersion string
6467// map of string to regex to be passed to assertOutput()
6568expectedOutput map [string ]string
6669}{
6770{
68- name : "test-data-source" ,
71+ name : "test-data-source" ,
72+ minVersion : "v0.0.0" ,
6973expectedOutput : map [string ]string {
7074"provisioner.arch" : runtime .GOARCH ,
7175"provisioner.id" : `[a-zA-Z0-9-]+` ,
@@ -86,6 +90,31 @@ func TestIntegration(t *testing.T) {
8690"workspace.template_name" : `test-data-source` ,
8791"workspace.template_version" : `.+` ,
8892"workspace.transition" : `start` ,
93+ },
94+ },
95+ {
96+ name : "workspace-owner" ,
97+ minVersion : "v2.12.0" ,
98+ expectedOutput : map [string ]string {
99+ "provisioner.arch" : runtime .GOARCH ,
100+ "provisioner.id" : `[a-zA-Z0-9-]+` ,
101+ "provisioner.os" : runtime .GOOS ,
102+ "workspace.access_port" : `\d+` ,
103+ "workspace.access_url" : `https?://\D+:\d+` ,
104+ "workspace.id" : `[a-zA-z0-9-]+` ,
105+ "workspace.name" : `` ,
106+ "workspace.owner" : `testing` ,
107+ "workspace.owner_email" : `testing@coder\.com` ,
108+ "workspace.owner_groups" : `\[\]` ,
109+ "workspace.owner_id" : `[a-zA-Z0-9]+` ,
110+ "workspace.owner_name" : `default` ,
111+ "workspace.owner_oidc_access_token" : `^$` , // TODO: need a test OIDC integration
112+ "workspace.owner_session_token" : `[a-zA-Z0-9-]+` ,
113+ "workspace.start_count" : `1` ,
114+ "workspace.template_id" : `[a-zA-Z0-9-]+` ,
115+ "workspace.template_name" : `workspace-owner` ,
116+ "workspace.template_version" : `.+` ,
117+ "workspace.transition" : `start` ,
89118"workspace_owner.email" : `testing@coder\.com` ,
90119"workspace_owner.full_name" : `default` ,
91120"workspace_owner.groups" : `\[\]` ,
@@ -98,9 +127,13 @@ func TestIntegration(t *testing.T) {
98127},
99128},
100129} {
130+ tt := tt
101131t .Run (tt .name , func (t * testing.T ) {
132+ t .Parallel ()
133+ if coderVersion != "latest" && semver .Compare (coderVersion , tt .minVersion ) < 0 {
134+ t .Skipf ("skipping due to CODER_VERSION %q < minVersion %q" , coderVersion , tt .minVersion )
135+ }
102136// Given: we have an existing Coder deployment running locally
103- ctrID := setup (ctx , t , tt .name , coderImg , coderVersion )
104137// Import named template
105138
106139// NOTE: Template create command was deprecated after this version
0 commit comments