fix: resolve failing filebrowser tests (#173)

## Description

- Increase timeouts for tests so that they reliably succeed.
- Remove filebrowser admin user creation since noauth is set
- Remove duplicate log declaration in coder_script

---

## Type of Change

- [ ] New module
- [X] Bug fix
- [ ] Feature/enhancement
- [ ] Documentation
- [ ] Other

---

## Module Information

<!-- Delete this section if not applicable -->

**Path:** `registry/[namespace]/modules/filebrowser`  
**New version:** `v1.1.1`  
**Breaking change:** [ ] Yes [X] No

---

## Testing & Validation

- [X] Tests pass (`bun test`)
- [X] Code formatted (`bun run fmt`)
- [X] Changes tested locally

---

## Related 


(https://github.com/coder/registry/actions/runs/15975017391/job/45055105439?pr=160)
This commit is contained in:
DevCats 2025-07-02 23:04:11 -05:00 committed by GitHub
parent 121328f671
commit 358f47b6ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 13 deletions

View File

@ -15,7 +15,7 @@ A file browser for your workspace.
module "filebrowser" { module "filebrowser" {
count = data.coder_workspace.me.start_count count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder" source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0" version = "1.1.1"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
} }
``` ```
@ -30,7 +30,7 @@ module "filebrowser" {
module "filebrowser" { module "filebrowser" {
count = data.coder_workspace.me.start_count count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder" source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0" version = "1.1.1"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
folder = "/home/coder/project" folder = "/home/coder/project"
} }
@ -42,7 +42,7 @@ module "filebrowser" {
module "filebrowser" { module "filebrowser" {
count = data.coder_workspace.me.start_count count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder" source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0" version = "1.1.1"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
database_path = ".config/filebrowser.db" database_path = ".config/filebrowser.db"
} }
@ -54,7 +54,7 @@ module "filebrowser" {
module "filebrowser" { module "filebrowser" {
count = data.coder_workspace.me.start_count count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/filebrowser/coder" source = "registry.coder.com/coder/filebrowser/coder"
version = "1.1.0" version = "1.1.1"
agent_id = coder_agent.example.id agent_id = coder_agent.example.id
agent_name = "main" agent_name = "main"
subdomain = false subdomain = false

View File

@ -55,7 +55,7 @@ describe("filebrowser", async () => {
); );
testBaseLine(output); testBaseLine(output);
}); }, 15000);
it("runs with database_path var", async () => { it("runs with database_path var", async () => {
const state = await runTerraformApply(import.meta.dir, { const state = await runTerraformApply(import.meta.dir, {
@ -63,7 +63,7 @@ describe("filebrowser", async () => {
database_path: ".config/filebrowser.db", database_path: ".config/filebrowser.db",
}); });
const output = await await executeScriptInContainer( const output = await executeScriptInContainer(
state, state,
"alpine/curl", "alpine/curl",
"sh", "sh",
@ -71,20 +71,21 @@ describe("filebrowser", async () => {
); );
testBaseLine(output); testBaseLine(output);
}); }, 15000);
it("runs with folder var", async () => { it("runs with folder var", async () => {
const state = await runTerraformApply(import.meta.dir, { const state = await runTerraformApply(import.meta.dir, {
agent_id: "foo", agent_id: "foo",
folder: "/home/coder/project", folder: "/home/coder/project",
}); });
const output = await await executeScriptInContainer( const output = await executeScriptInContainer(
state, state,
"alpine/curl", "alpine/curl",
"sh", "sh",
"apk add bash", "apk add bash",
); );
});
}, 15000);
it("runs with subdomain=false", async () => { it("runs with subdomain=false", async () => {
const state = await runTerraformApply(import.meta.dir, { const state = await runTerraformApply(import.meta.dir, {
@ -93,7 +94,7 @@ describe("filebrowser", async () => {
subdomain: false, subdomain: false,
}); });
const output = await await executeScriptInContainer( const output = await executeScriptInContainer(
state, state,
"alpine/curl", "alpine/curl",
"sh", "sh",
@ -101,5 +102,5 @@ describe("filebrowser", async () => {
); );
testBaseLine(output); testBaseLine(output);
}); }, 15000);
}); });

View File

@ -97,7 +97,6 @@ resource "coder_script" "filebrowser" {
LOG_PATH : var.log_path, LOG_PATH : var.log_path,
PORT : var.port, PORT : var.port,
FOLDER : var.folder, FOLDER : var.folder,
LOG_PATH : var.log_path,
DB_PATH : var.database_path, DB_PATH : var.database_path,
SUBDOMAIN : var.subdomain, SUBDOMAIN : var.subdomain,
SERVER_BASE_PATH : local.server_base_path SERVER_BASE_PATH : local.server_base_path
@ -128,3 +127,4 @@ locals {
url = "http://localhost:${var.port}${local.server_base_path}" url = "http://localhost:${var.port}${local.server_base_path}"
healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/health" healthcheck_url = "http://localhost:${var.port}${local.server_base_path}/health"
} }

View File

@ -25,7 +25,7 @@ export FB_DATABASE="${DB_PATH}"
# Check if filebrowser db exists # Check if filebrowser db exists
if [[ ! -f "${DB_PATH}" ]]; then if [[ ! -f "${DB_PATH}" ]]; then
filebrowser config init 2>&1 | tee -a ${LOG_PATH} 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 fi
filebrowser config set --baseurl=${SERVER_BASE_PATH} --port=${PORT} --auth.method=noauth --root=$ROOT_DIR 2>&1 | tee -a ${LOG_PATH} filebrowser config set --baseurl=${SERVER_BASE_PATH} --port=${PORT} --auth.method=noauth --root=$ROOT_DIR 2>&1 | tee -a ${LOG_PATH}