-
Notifications
You must be signed in to change notification settings - Fork 24
Add data source attribute for owner email address #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,10 @@ func TestProvider(t *testing.T) { | |
| } | ||
|
|
||
| func TestWorkspace(t *testing.T) { | ||
| t.Parallel() | ||
| t.Setenv("CODER_WORKSPACE_OWNER", "owner123") | ||
| t.Setenv("CODER_WORKSPACE_OWNER_NAME", "Workspace Owner Jr.") | ||
|
||
| t.Setenv("CODER_WORKSPACE_OWNER_EMAIL", "owner123@example.com") | ||
|
|
||
| resource.Test(t, resource.TestCase{ | ||
| Providers: map[string]*schema.Provider{ | ||
| "coder": provider.New(), | ||
|
|
@@ -37,9 +40,14 @@ func TestWorkspace(t *testing.T) { | |
| require.Len(t, state.Modules[0].Resources, 1) | ||
| resource := state.Modules[0].Resources["data.coder_workspace.me"] | ||
| require.NotNil(t, resource) | ||
| value := resource.Primary.Attributes["transition"] | ||
|
|
||
| attribs := resource.Primary.Attributes | ||
| value := attribs["transition"] | ||
| require.NotNil(t, value) | ||
| t.Log(value) | ||
| require.Equal(t, "owner123", attribs["owner"]) | ||
| require.Equal(t, "Workspace Owner Jr.", attribs["owner_name"]) | ||
| require.Equal(t, "owner123@example.com", attribs["owner_email"]) | ||
| return nil | ||
| }, | ||
| }}, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other attributes handled by this function all have a non-empty default value in case the expected environment var is missing. But I can't think of a good default for the email address, and in my testing, there didn't seem to be any problem with leaving it empty.