mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
ci: make sure golden files are actually up to date (#15989)
This commit is contained in:
@@ -271,6 +271,15 @@ jobs:
|
||||
# coderd/rbac/object_gen.go:1:1: syntax error: package statement must be first
|
||||
run: "make --output-sync -B gen"
|
||||
|
||||
- name: make update-golden-files
|
||||
run: |
|
||||
make clean/golden-files
|
||||
# Notifications require DB, we could start a DB instance here but
|
||||
# let's just restore for now.
|
||||
git checkout -- coderd/notifications/testdata/rendered-templates
|
||||
# As above, skip `-j` flag.
|
||||
make --output-sync -B update-golden-files
|
||||
|
||||
- name: Check for unstaged files
|
||||
run: ./scripts/check_unstaged.sh
|
||||
|
||||
|
||||
@@ -702,18 +702,33 @@ coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS)
|
||||
|
||||
update-golden-files: \
|
||||
cli/testdata/.gen-golden \
|
||||
helm/coder/tests/testdata/.gen-golden \
|
||||
helm/provisioner/tests/testdata/.gen-golden \
|
||||
enterprise/cli/testdata/.gen-golden \
|
||||
enterprise/tailnet/testdata/.gen-golden \
|
||||
tailnet/testdata/.gen-golden \
|
||||
coderd/.gen-golden \
|
||||
coderd/notifications/.gen-golden \
|
||||
provisioner/terraform/testdata/.gen-golden
|
||||
enterprise/cli/testdata/.gen-golden \
|
||||
enterprise/tailnet/testdata/.gen-golden \
|
||||
helm/coder/tests/testdata/.gen-golden \
|
||||
helm/provisioner/tests/testdata/.gen-golden \
|
||||
provisioner/terraform/testdata/.gen-golden \
|
||||
tailnet/testdata/.gen-golden
|
||||
.PHONY: update-golden-files
|
||||
|
||||
clean/golden-files:
|
||||
find . -type f -name '.gen-golden' -delete
|
||||
find \
|
||||
cli/testdata \
|
||||
coderd/notifications/testdata \
|
||||
coderd/testdata \
|
||||
enterprise/cli/testdata \
|
||||
enterprise/tailnet/testdata \
|
||||
helm/coder/tests/testdata \
|
||||
helm/provisioner/tests/testdata \
|
||||
provisioner/terraform/testdata \
|
||||
tailnet/testdata \
|
||||
-type f -name '*.golden' -delete
|
||||
.PHONY: clean/golden-files
|
||||
|
||||
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES) $(wildcard cli/*_test.go)
|
||||
go test ./cli -run="Test(CommandHelp|ServerYAML|ErrorExamples)" -update
|
||||
go test ./cli -run="Test(CommandHelp|ServerYAML|ErrorExamples|.*Golden)" -update
|
||||
touch "$@"
|
||||
|
||||
enterprise/cli/testdata/.gen-golden: $(wildcard enterprise/cli/testdata/*.golden) $(wildcard cli/*.tpl) $(GO_SRC_FILES) $(wildcard enterprise/cli/*_test.go)
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
Usage: coder templates plan <directory>
|
||||
|
||||
Plan a template push from the current directory
|
||||
|
||||
---
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,15 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder provisionerd
|
||||
|
||||
Manage provisioner daemons
|
||||
|
||||
Aliases: provisioner
|
||||
|
||||
SUBCOMMANDS:
|
||||
keys Manage provisioner keys
|
||||
start Run a provisioner daemon
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,16 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder provisionerd keys
|
||||
|
||||
Manage provisioner keys
|
||||
|
||||
Aliases: key
|
||||
|
||||
SUBCOMMANDS:
|
||||
create Create a new provisioner key
|
||||
delete Delete a provisioner key
|
||||
list List provisioner keys in an organization
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,16 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder provisionerd keys create [flags] <name>
|
||||
|
||||
Create a new provisioner key
|
||||
|
||||
OPTIONS:
|
||||
-O, --org string, $CODER_ORGANIZATION
|
||||
Select which organization (uuid or name) to use.
|
||||
|
||||
-t, --tag string-array, $CODER_PROVISIONERD_TAGS
|
||||
Tags to filter provisioner jobs by.
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,18 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder provisionerd keys delete [flags] <name>
|
||||
|
||||
Delete a provisioner key
|
||||
|
||||
Aliases: rm
|
||||
|
||||
OPTIONS:
|
||||
-O, --org string, $CODER_ORGANIZATION
|
||||
Select which organization (uuid or name) to use.
|
||||
|
||||
-y, --yes bool
|
||||
Bypass prompts.
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,15 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder provisionerd keys list [flags]
|
||||
|
||||
List provisioner keys in an organization
|
||||
|
||||
Aliases: ls
|
||||
|
||||
OPTIONS:
|
||||
-O, --org string, $CODER_ORGANIZATION
|
||||
Select which organization (uuid or name) to use.
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,55 +0,0 @@
|
||||
coder v0.0.0-devel
|
||||
|
||||
USAGE:
|
||||
coder provisionerd start [flags]
|
||||
|
||||
Run a provisioner daemon
|
||||
|
||||
OPTIONS:
|
||||
-O, --org string, $CODER_ORGANIZATION
|
||||
Select which organization (uuid or name) to use.
|
||||
|
||||
-c, --cache-dir string, $CODER_CACHE_DIRECTORY (default: [cache dir])
|
||||
Directory to store cached data.
|
||||
|
||||
--log-filter string-array, $CODER_PROVISIONER_DAEMON_LOG_FILTER
|
||||
Filter debug logs by matching against a given regex. Use .* to match
|
||||
all debug logs.
|
||||
|
||||
--log-human string, $CODER_PROVISIONER_DAEMON_LOGGING_HUMAN (default: /dev/stderr)
|
||||
Output human-readable logs to a given file.
|
||||
|
||||
--log-json string, $CODER_PROVISIONER_DAEMON_LOGGING_JSON
|
||||
Output JSON logs to a given file.
|
||||
|
||||
--log-stackdriver string, $CODER_PROVISIONER_DAEMON_LOGGING_STACKDRIVER
|
||||
Output Stackdriver compatible logs to a given file.
|
||||
|
||||
--name string, $CODER_PROVISIONER_DAEMON_NAME
|
||||
Name of this provisioner daemon. Defaults to the current hostname
|
||||
without FQDN.
|
||||
|
||||
--poll-interval duration, $CODER_PROVISIONERD_POLL_INTERVAL (default: 1s)
|
||||
Deprecated and ignored.
|
||||
|
||||
--poll-jitter duration, $CODER_PROVISIONERD_POLL_JITTER (default: 100ms)
|
||||
Deprecated and ignored.
|
||||
|
||||
--prometheus-address string, $CODER_PROMETHEUS_ADDRESS (default: 127.0.0.1:2112)
|
||||
The bind address to serve prometheus metrics.
|
||||
|
||||
--prometheus-enable bool, $CODER_PROMETHEUS_ENABLE (default: false)
|
||||
Serve prometheus metrics on the address defined by prometheus address.
|
||||
|
||||
--psk string, $CODER_PROVISIONER_DAEMON_PSK
|
||||
Pre-shared key to authenticate with Coder server.
|
||||
DEPRECATED: Use --key instead.
|
||||
|
||||
-t, --tag string-array, $CODER_PROVISIONERD_TAGS
|
||||
Tags to filter provisioner jobs by.
|
||||
|
||||
--verbose bool, $CODER_PROVISIONER_DAEMON_VERBOSE (default: false)
|
||||
Output debug-level logs.
|
||||
|
||||
———
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -1,17 +0,0 @@
|
||||
Usage: coder workspace-proxy
|
||||
|
||||
Manage workspace proxies
|
||||
|
||||
Aliases: wsproxy
|
||||
|
||||
[1mSubcommands[0m
|
||||
create Create a workspace proxy
|
||||
delete Delete a workspace proxy
|
||||
edit Edit a workspace proxy
|
||||
ls List all workspace proxies
|
||||
regenerate-token Regenerate a workspace proxy authentication token. This
|
||||
will invalidate the existing authentication token.
|
||||
server Start a workspace proxy server
|
||||
|
||||
---
|
||||
Run `coder --help` for a list of global options.
|
||||
@@ -121,6 +121,7 @@ func TestRenderChart(t *testing.T) {
|
||||
helmPath := lookupHelm(t)
|
||||
err := updateHelmDependencies(t, helmPath, "..")
|
||||
require.NoError(t, err, "failed to build Helm dependencies")
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
@@ -162,6 +163,9 @@ func TestUpdateGoldenFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
helmPath := lookupHelm(t)
|
||||
err := updateHelmDependencies(t, helmPath, "..")
|
||||
require.NoError(t, err, "failed to build Helm dependencies")
|
||||
|
||||
for _, tc := range testCases {
|
||||
if tc.expectedError != "" {
|
||||
t.Logf("skipping test case %q with render error", tc.name)
|
||||
@@ -171,7 +175,8 @@ func TestUpdateGoldenFiles(t *testing.T) {
|
||||
valuesPath := tc.valuesFilePath()
|
||||
templateOutput, err := runHelmTemplate(t, helmPath, "..", valuesPath)
|
||||
if err != nil {
|
||||
t.Logf("Command output:\n%s", templateOutput)
|
||||
t.Logf("error running `helm template -f %q`: %v", valuesPath, err)
|
||||
t.Logf("output: %s", templateOutput)
|
||||
}
|
||||
require.NoError(t, err, "failed to run `helm template -f %q`", valuesPath)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user