chore(examples): add MODULE_NAME.tftest.hcl to new module sample and make run.sh optional

This commit is contained in:
Muhammad Atif Ali
2025-08-08 16:36:30 +05:00
parent fb657b875d
commit a5edad7f17
2 changed files with 26 additions and 3 deletions
+21
View File
@@ -0,0 +1,21 @@
run "plan_with_required_vars" {
command = plan
variables {
agent_id = "example-agent-id"
}
}
run "app_url_uses_port" {
command = plan
variables {
agent_id = "example-agent-id"
port = 19999
}
assert {
condition = resource.coder_app.MODULE_NAME.url == "http://localhost:19999"
error_message = "Expected MODULE_NAME app URL to include configured port"
}
}
+5 -3
View File
@@ -31,7 +31,7 @@ if [ -d "registry/$NAMESPACE/modules/$MODULE_NAME" ]; then
fi
mkdir -p "registry/${NAMESPACE}/modules/${MODULE_NAME}"
# Copy required files from the example module
# Copy required files from the example module (includes Terraform tests)
cp -r examples/modules/* "registry/${NAMESPACE}/modules/${MODULE_NAME}/"
# Change to module directory
@@ -48,5 +48,7 @@ else
sed -i "s/MODULE_NAME/${MODULE_NAME}/g" README.md
fi
# Make run.sh executable
chmod +x run.sh
# Make run.sh executable (if present)
if [ -f run.sh ]; then
chmod +x run.sh
fi