Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(provisioner): handle multiple agents, apps, scripts and envs#13741

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 11 commits intomainfrom12949-apps
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
fix: multiple agents, independent apps
  • Loading branch information
@mtojek
mtojek committedJul 1, 2024
commit41f2de0f95969fdc5aac11e345cff0f50700cd99
54 changes: 53 additions & 1 deletionprovisioner/terraform/resources_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,56 @@ func TestConvertResources(t *testing.T) {
}},
}},
},
"multiple-agents-multiple-apps": {
resources: []*proto.Resource{{
Name: "dev1",
Type: "null_resource",
Agents: []*proto.Agent{{
Name: "dev1",
OperatingSystem: "linux",
Architecture: "amd64",
Apps: []*proto.App{
{
Slug: "app1",
DisplayName: "app1",
// Subdomain defaults to false if unspecified.
Subdomain: false,
},
{
Slug: "app2",
DisplayName: "app2",
Subdomain: true,
Healthcheck: &proto.Healthcheck{
Url: "http://localhost:13337/healthz",
Interval: 5,
Threshold: 6,
},
},
},
Auth: &proto.Agent_Token{},
ConnectionTimeoutSeconds: 120,
DisplayApps: &displayApps,
}},
}, {
Name: "dev2",
Type: "null_resource",
Agents: []*proto.Agent{{
Name: "dev2",
OperatingSystem: "linux",
Architecture: "amd64",
Apps: []*proto.App{
{
Slug: "app3",
DisplayName: "app3",
Subdomain: false,
},
},
Auth: &proto.Agent_Token{},
ConnectionTimeoutSeconds: 120,
DisplayApps: &displayApps,
}},
}},
},
// Tests fetching metadata about workspace resources.
"resource-metadata": {
resources: []*proto.Resource{{
Expand DownExpand Up@@ -536,6 +586,9 @@ func TestConvertResources(t *testing.T) {
}},
},
} {
if folderName != "multiple-agents-multiple-apps" {
continue
}
folderName := folderName
expected := expected
t.Run(folderName, func(t *testing.T) {
Expand DownExpand Up@@ -642,7 +695,6 @@ func TestConvertResources(t *testing.T) {
var resourcesMap []map[string]interface{}
err = json.Unmarshal(data, &resourcesMap)
require.NoError(t, err)

require.Equal(t, expectedMap, resourcesMap)
require.ElementsMatch(t, expected.externalAuthProviders, state.ExternalAuthProviders)
})
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.22.0"
}
}
}

resource "coder_agent" "dev1" {
os = "linux"
arch = "amd64"
}

resource "coder_agent" "dev2" {
os = "linux"
arch = "amd64"
}

# app1 is for testing subdomain default.
resource "coder_app" "app1" {
agent_id = coder_agent.dev1.id
slug = "app1"
# subdomain should default to false.
# subdomain = false
}

# app2 tests that subdomaincan be true, and that healthchecks work.
resource "coder_app" "app2" {
agent_id = coder_agent.dev1.id
slug = "app2"
subdomain = true
healthcheck {
url = "http://localhost:13337/healthz"
interval = 5
threshold = 6
}
}

# app3 tests that subdomain can explicitly be false.
resource "coder_app" "app3" {
agent_id = coder_agent.dev2.id
slug = "app3"
subdomain = false
}

resource "null_resource" "dev1" {
depends_on = [
coder_agent.dev1
]
}

resource "null_resource" "dev2" {
depends_on = [
coder_agent.dev2
]
}

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp