fluxcd-flux2/cmd/flux
Andrew Jenkins 437a7a2852 Fix failure in TestTrace/* when timezone isn't UTC
The TestTrace/Deployment and TestTrace/HelmRelease test cases fail in
environments where the timezone isn't UTC, because they compare a local time
string to the golden file, which has time in UTC.  Here is an example:

```
--- FAIL: TestTrace (0.12s)
    --- FAIL: TestTrace/Deployment (0.08s)
        main_test.go:337: Mismatch from golden file 'testdata/trace/deployment.golden': Mismatch from expected value (-want +got):
              strings.Join({
                ... // 88 identical bytes
                " Flux\n---\nHelmRelease:    podinfo\nNamespace:      podinfo-8\nRevi",
                "sion:       6.0.0\nStatus:         Last reconciled at 2021-07-16 ",
            -   "15:42:20 +0000 UTC",
            +   "09:42:20 -0600 MDT",
                "\nMessage:        Release reconciliation succeeded\n---\nHelmChart:",
                "      podinfo-podinfo\nNamespace:      flux-system-9\nChart:      ",
                "    podinfo\nVersion:        6.0.0\nRevision:       6.0.0\nStatus: ",
                "        Last reconciled at 2021-07-16 ",
            -   "15:32:09 +0000 UTC",
            +   "09:32:09 -0600 MDT",
                "\nMessage:        Fetched revision: 6.0.0\n---\nHelmRepository: pod",
                "info\nNamespace:      flux-system-9\nURL:            https://stefa",
                "nprodan.github.io/podinfo\nRevision:       8411f23d07d3701f0e96e7",
                "d9e503b7936d7e1d56\nStatus:         Last reconciled at 2021-07-",
            -   "1",
                "1",
            -   " 00:25:46 +0000 UTC",
            +   "0 18:25:46 -0600 MDT",
                "\nMessage:        Fetched revision: 8411f23d07d3701f0e96e7d9e503b",
                "7936d7e1d56\n",
              }, "")
```

This commit fixes the issue by converting the golden test times to local
time before comparing. The utility function toLocalTime() is added to
trace_test.go, and then it is used to provide localized times as
template parameters to the golden files.

Signed-off-by: Andrew Jenkins <andrew@aspenmesh.io>
2022-02-16 09:36:00 -07:00
..
testdata Fix failure in TestTrace/* when timezone isn't UTC 2022-02-16 09:36:00 -07:00
alert.go Request reconcile using patch instead of update 2021-08-04 13:08:36 +02:00
alert_provider.go Request reconcile using patch instead of update 2021-08-04 13:08:36 +02:00
bootstrap.go bootstrap: Set ECDSA as the default SSH key algorithm 2021-11-02 16:22:16 +02:00
bootstrap_bitbucket_server.go Add GPG options to Gitlab and BitBucket bootstraps 2022-02-03 11:07:55 -05:00
bootstrap_git.go Avoid overwriting the host port on http requests 2022-01-13 10:32:10 +01:00
bootstrap_github.go Replace github boostrap GPG options 2022-02-03 11:09:10 -05:00
bootstrap_gitlab.go Add GPG options to Gitlab and BitBucket bootstraps 2022-02-03 11:07:55 -05:00
build.go Add a build kustomization feature 2022-01-20 11:51:56 +01:00
build_kustomization.go Add graceful shutdown when interrupted 2022-01-20 13:21:07 +01:00
build_kustomization_test.go Add e2e tests for build/diff kustomization 2022-01-20 11:51:57 +01:00
check.go Set minimum supported version to Kubernetes 1.20.6 2022-01-26 11:21:32 +02:00
check_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
completion.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
completion_bash.go Tidy up command descriptions 2021-03-26 10:20:42 +01:00
completion_fish.go Tidy up command descriptions 2021-03-26 10:20:42 +01:00
completion_powershell.go Tidy up command descriptions 2021-03-26 10:20:42 +01:00
completion_zsh.go Fix flux completion zsh to work with source only 2021-09-17 17:49:47 +09:00
create.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_alert.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_alertprovider.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_helmrelease.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_image.go Tidy up command descriptions 2021-03-26 10:20:42 +01:00
create_image_policy.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_image_repository.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_image_update.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_kustomization.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_receiver.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_secret.go Add sourcesecret and kustomization manifestgen 2021-02-26 16:58:41 +01:00
create_secret_git.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_secret_git_test.go validate that object name adheres to RFC 1123 for flux create commands 2022-02-16 10:51:03 +01:00
create_secret_helm.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_secret_helm_test.go validate that object name adheres to RFC 1123 for flux create commands 2022-02-16 10:51:03 +01:00
create_secret_tls.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_secret_tls_test.go validate that object name adheres to RFC 1123 for flux create commands 2022-02-16 10:51:03 +01:00
create_source.go Add fetch timeout arg to create source commands 2021-11-01 15:37:58 +02:00
create_source_bucket.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_source_git.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_source_git_test.go validate that object name adheres to RFC 1123 for flux create commands 2022-02-16 10:51:03 +01:00
create_source_helm.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_tenant.go Remove validation from sub-commands 2022-02-16 11:04:05 +01:00
create_test.go validate that object name adheres to RFC 1123 for flux create commands 2022-02-16 10:51:03 +01:00
delete.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
delete_alert.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_alertprovider.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_helmrelease.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_image.go Rename flux delete auto to flux delete image 2021-02-04 11:57:40 +00:00
delete_image_policy.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_image_repository.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_image_update.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_kustomization.go Update kustomize-controller API to v1beta2 2021-10-08 21:11:06 +03:00
delete_receiver.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_source.go Rename gotk binary to flux 2020-10-29 16:25:16 +01:00
delete_source_bucket.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_source_git.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
delete_source_helm.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
diff.go Add contextual error code for flux diff kustomization 2022-02-03 13:41:57 +01:00
diff_kustomization.go Add contextual error code for flux diff kustomization 2022-02-03 13:41:57 +01:00
diff_kustomization_test.go Mask dockerconfigjson secret types and support StringData secrets 2022-02-07 09:45:38 +01:00
docgen.go Remove ' command' from Flux CLI docs title 2021-05-06 08:52:36 +02:00
export.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
export_alert.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_alertprovider.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_helmrelease.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_image.go Rename "auto" subcommands to "image" 2020-12-11 16:34:18 +00:00
export_image_policy.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_image_repository.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_image_update.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_kustomization.go Update kustomize-controller API to v1beta2 2021-10-08 21:11:06 +03:00
export_receiver.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_secret.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
export_source.go Rename gotk binary to flux 2020-10-29 16:25:16 +01:00
export_source_bucket.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_source_git.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_source_helm.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
export_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
get.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
get_alert.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_alertprovider.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_all.go Update kustomize-controller API to v1beta2 2021-10-08 21:11:06 +03:00
get_helmrelease.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_image.go Output Usage for flux get <sources|images> 2022-01-26 16:03:22 -07:00
get_image_all.go Adds a watch flag to the get command 2021-08-06 13:44:06 +02:00
get_image_policy.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_image_repository.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_image_update.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_kustomization.go Shorten sha commit 2022-01-20 11:13:25 +01:00
get_receiver.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_source.go Output Usage for flux get <sources|images> 2022-01-26 16:03:22 -07:00
get_source_all.go Adds a watch flag to the get command 2021-08-06 13:44:06 +02:00
get_source_bucket.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_source_chart.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
get_source_git.go Shorten sha commit 2022-01-20 11:13:25 +01:00
get_source_helm.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
helmrelease.go Request reconcile using patch instead of update 2021-08-04 13:08:36 +02:00
helmrelease_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
image.go Request reconcile using patch instead of update 2021-08-04 13:08:36 +02:00
image_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
install.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
kustomization.go Update kustomize-controller API to v1beta2 2021-10-08 21:11:06 +03:00
kustomization_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
log.go Add Warningf to logger interface amd impl 2021-04-08 10:48:27 +03:00
logs.go Use text/template 2022-02-14 23:59:20 +01:00
logs_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
main.go Mask dockerconfigjson secret types and support StringData secrets 2022-02-07 09:45:38 +01:00
main_e2e_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
main_test.go Add contextual error code for flux diff kustomization 2022-02-03 13:41:57 +01:00
main_unit_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
manifests.embed.go Add missing copyright headers 2021-10-14 16:14:28 +03:00
object.go Request reconcile using patch instead of update 2021-08-04 13:08:36 +02:00
receiver.go Request reconcile using patch instead of update 2021-08-04 13:08:36 +02:00
reconcile.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
reconcile_alert.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
reconcile_alertprovider.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
reconcile_helmrelease.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
reconcile_image.go Rename "auto" subcommands to "image" 2020-12-11 16:34:18 +00:00
reconcile_image_repository.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
reconcile_image_updateauto.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
reconcile_kustomization.go Update kustomize-controller API to v1beta2 2021-10-08 21:11:06 +03:00
reconcile_receiver.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
reconcile_source.go Rename gotk binary to flux 2020-10-29 16:25:16 +01:00
reconcile_source_bucket.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
reconcile_source_git.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
reconcile_source_helm.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
reconcile_with_source.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
resume.go use client.Patch for suspend/resume operations 2022-02-04 12:06:39 +01:00
resume_alert.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_helmrelease.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_image.go Rename "auto" subcommands to "image" 2020-12-11 16:34:18 +00:00
resume_image_repository.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_image_updateauto.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_kustomization.go Update kustomize-controller API to v1beta2 2021-10-08 21:11:06 +03:00
resume_receiver.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_source.go Add resume source commands 2020-11-26 16:40:54 +02:00
resume_source_bucket.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_source_chart.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_source_git.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
resume_source_helm.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
source.go Request reconcile using patch instead of update 2021-08-04 13:08:36 +02:00
status.go Update dependencies 2022-01-13 19:37:14 +02:00
suspend.go use client.Patch for suspend/resume operations 2022-02-04 12:06:39 +01:00
suspend_alert.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_helmrelease.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_image.go Rename "auto" subcommands to "image" 2020-12-11 16:34:18 +00:00
suspend_image_repository.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_image_updateauto.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_kustomization.go Update kustomize-controller API to v1beta2 2021-10-08 21:11:06 +03:00
suspend_receiver.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_source.go Add suspend source commands 2020-11-26 16:22:47 +02:00
suspend_source_bucket.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_source_chart.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_source_git.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
suspend_source_helm.go Add dynamic completion suppport 2021-09-18 17:27:47 +09:00
trace.go trace: fix lint warning 2022-01-13 15:52:47 +01:00
trace_test.go Fix failure in TestTrace/* when timezone isn't UTC 2022-02-16 09:36:00 -07:00
tree.go Add flux tree command 2021-10-25 13:45:13 +03:00
tree_kustomization.go Update dependencies 2022-01-13 19:37:14 +02:00
tree_kustomization_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00
uninstall.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
version.go Use k8s.io/cli-runtime for kubernetes flags 2022-01-07 16:01:24 +01:00
version_utils.go Add flux version command 2021-10-05 10:29:00 +01:00
version_utils_test.go Update Go to v1.17 2022-01-10 16:30:38 +01:00