Skip to content

fix: resolve failing filebrowser tests #173

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

Merged
merged 9 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions registry/coder/modules/filebrowser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A file browser for your workspace.
module "filebrowser" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0"
version = "1.1.1"
agent_id = coder_agent.example.id
}
```
Expand All @@ -30,7 +30,7 @@ module "filebrowser" {
module "filebrowser" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0"
version = "1.1.1"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
}
Expand All @@ -42,7 +42,7 @@ module "filebrowser" {
module "filebrowser" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0"
version = "1.1.1"
agent_id = coder_agent.example.id
database_path = ".config/filebrowser.db"
}
Expand All @@ -54,7 +54,7 @@ module "filebrowser" {
module "filebrowser" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0"
version = "1.1.1"
agent_id = coder_agent.example.id
agent_name = "main"
subdomain = false
Expand Down
15 changes: 8 additions & 7 deletions registry/coder/modules/filebrowser/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,36 +55,37 @@ describe("filebrowser", async () => {
);

testBaseLine(output);
});
}, 15000);

it("runs with database_path var", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
database_path: ".config/filebrowser.db",
});

const output = await await executeScriptInContainer(
const output = await executeScriptInContainer(
state,
"alpine/curl",
"sh",
"apk add bash",
);

testBaseLine(output);
});
}, 15000);

it("runs with folder var", async () => {
const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo",
folder: "/home/coder/project",
});
const output = await await executeScriptInContainer(
const output = await executeScriptInContainer(
state,
"alpine/curl",
"sh",
"apk add bash",
);
});

}, 15000);

it("runs with subdomain=false", async () => {
const state = await runTerraformApply(import.meta.dir, {
Expand All @@ -93,13 +94,13 @@ describe("filebrowser", async () => {
subdomain: false,
});

const output = await await executeScriptInContainer(
const output = await executeScriptInContainer(
state,
"alpine/curl",
"sh",
"apk add bash",
);

testBaseLine(output);
});
}, 15000);
});
2 changes: 1 addition & 1 deletion registry/coder/modules/filebrowser/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ resource "coder_script" "filebrowser" {
LOG_PATH : var.log_path,
PORT : var.port,
FOLDER : var.folder,
LOG_PATH : var.log_path,
DB_PATH : var.database_path,
SUBDOMAIN : var.subdomain,
SERVER_BASE_PATH : local.server_base_path
Expand Down Expand Up @@ -128,3 +127,4 @@ locals {
url = "http://localhost:${var.port}${local.server_base_path}"
healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/health"
}

2 changes: 1 addition & 1 deletion registry/coder/modules/filebrowser/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export FB_DATABASE="${DB_PATH}"
# Check if filebrowser db exists
if [[ ! -f "${DB_PATH}" ]]; then
filebrowser config init 2>&1 | tee -a ${LOG_PATH}
filebrowser users add admin "" --perm.admin=true --viewMode=mosaic 2>&1 | tee -a ${LOG_PATH}
filebrowser users add admin "coderPASSWORD" --perm.admin=true --viewMode=mosaic 2>&1 | tee -a ${LOG_PATH}
fi

filebrowser config set --baseurl=${SERVER_BASE_PATH} --port=${PORT} --auth.method=noauth --root=$ROOT_DIR 2>&1 | tee -a ${LOG_PATH}
Expand Down