From 88ad58ad6e9f6ec4e4c6b64a4e20d13e9f40efcb Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:21:48 +0530 Subject: [PATCH 01/33] go mod update --- .github/dependabot.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 70b9fb624..d5ce818a1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,7 +8,4 @@ updates: schedule: interval: "daily" time: "05:00" - timezone: "UTC" - ignore: - - dependency-name: "*" - update-types: ["version-update:semver-patch"] + timezone: "UTC" \ No newline at end of file From f46e236475dc46d6cb056547c018b4dd3aef48ff Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:25:58 +0530 Subject: [PATCH 02/33] update compatible terraform version constraint --- version/terraform.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/terraform.go b/version/terraform.go index 9653a5f22..3a8538e6d 100644 --- a/version/terraform.go +++ b/version/terraform.go @@ -16,7 +16,7 @@ import ( // account for. The upper bound may be removed once CTS has protocols // set in place for compatible modules and can handle Terraform syntax changes // and enhancements between versions. -const CompatibleTerraformVersionConstraint = ">= 0.13.0, < 1.3.0" +const CompatibleTerraformVersionConstraint = ">= 0.13.0, <= 1.6.2" // TerraformConstraint is the go-version constraint variable for // CompatibleTerraformVersionConstraint From bab3b0d012b8be562ba0e431f957e62ad4ae70cb Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:28:05 +0530 Subject: [PATCH 03/33] go version lat4est --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/weekly-tests.yml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91611aa75..f9f2fbbbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ${{ env.GO_VERSION }} + go-version: latest - name: Run Go checks run: | @@ -78,7 +78,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ${{ env.GO_VERSION }} + go-version: latest - name: Build run: | @@ -96,7 +96,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ${{ env.GO_VERSION }} + go-version: latest - name: Setup gotestsum uses: ./.github/actions/setup-gotestsum @@ -135,7 +135,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ${{ env.GO_VERSION }} + go-version: latest - name: Split E2E tests run: | @@ -164,7 +164,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ${{ env.GO_VERSION }} + go-version: latest - name: Setup gotestsum uses: ./.github/actions/setup-gotestsum diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index 73b1a26c0..60db62fc0 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ${{ env.GO_VERSION }} + go-version: latest - name: Run compatability tests run: | @@ -44,7 +44,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: ${{ env.GO_VERSION }} + go-version: latest - name: Setup Vault uses: ./.github/actions/setup-vault From e983448cc536b70e8c9d2c08bbacba14633e9f6f Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:30:44 +0530 Subject: [PATCH 04/33] latest --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/weekly-tests.yml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9f2fbbbd..edab506bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: latest + go-version: "latest" - name: Run Go checks run: | @@ -78,7 +78,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: latest + go-version: "latest" - name: Build run: | @@ -96,7 +96,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: latest + go-version: "latest" - name: Setup gotestsum uses: ./.github/actions/setup-gotestsum @@ -135,7 +135,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: latest + go-version: "latest" - name: Split E2E tests run: | @@ -164,7 +164,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: latest + go-version: "latest" - name: Setup gotestsum uses: ./.github/actions/setup-gotestsum diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index 60db62fc0..6e0118ee6 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -28,7 +28,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: latest + go-version: "latest" - name: Run compatability tests run: | @@ -44,7 +44,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: latest + go-version: "latest" - name: Setup Vault uses: ./.github/actions/setup-vault From a30a5818cd220b376a86e96b819142dd8bfba612 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:34:30 +0530 Subject: [PATCH 05/33] go version bump --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/weekly-tests.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edab506bd..8b0dbdee7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.18 + GO_VERSION: 1.20.10 CONSUL_VERSION: 1.12.1 TERRAFORM_VERSION: 1.2.2 @@ -45,7 +45,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: "latest" + go-version: ${{ env.GO_VERSION }} - name: Run Go checks run: | @@ -78,7 +78,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: "latest" + go-version: ${{ env.GO_VERSION }} - name: Build run: | @@ -96,7 +96,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: "latest" + go-version: ${{ env.GO_VERSION }} - name: Setup gotestsum uses: ./.github/actions/setup-gotestsum @@ -135,7 +135,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: "latest" + go-version: ${{ env.GO_VERSION }} - name: Split E2E tests run: | @@ -164,7 +164,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: "latest" + go-version: ${{ env.GO_VERSION }} - name: Setup gotestsum uses: ./.github/actions/setup-gotestsum diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index 6e0118ee6..098baa006 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.18 + GO_VERSION: 1.20.10 CONSUL_VERSION: 1.12.1 TERRAFORM_VERSION: 1.2.2 VAULT_VERSION: 1.10.3 @@ -28,7 +28,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: "latest" + go-version: ${{ env.GO_VERSION }} - name: Run compatability tests run: | @@ -44,7 +44,7 @@ jobs: - name: Set up Go uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 with: - go-version: "latest" + go-version: ${{ env.GO_VERSION }} - name: Setup Vault uses: ./.github/actions/setup-vault From bb224a5b168a12fdbcb821f461625db85810228f Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:40:27 +0530 Subject: [PATCH 06/33] fix terraform version --- .../reference-example/sync-tasks/my-task/main.tf | 2 +- templates/tftmpl/root_test.go | 12 ++++++------ templates/tftmpl/testdata/catalog-services/main.tf | 2 +- templates/tftmpl/testdata/main.tf | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/reference-example/sync-tasks/my-task/main.tf b/examples/reference-example/sync-tasks/my-task/main.tf index 8bfad1288..f8136b161 100644 --- a/examples/reference-example/sync-tasks/my-task/main.tf +++ b/examples/reference-example/sync-tasks/my-task/main.tf @@ -12,7 +12,7 @@ # Description: automate services for website X terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" required_providers { myprovider = { source = "namespace/myprovider" diff --git a/templates/tftmpl/root_test.go b/templates/tftmpl/root_test.go index 3875ac428..0e3a32b3c 100644 --- a/templates/tftmpl/root_test.go +++ b/templates/tftmpl/root_test.go @@ -32,14 +32,14 @@ func TestAppendRootTerraformBlock_backend(t *testing.T) { "nil", nil, `terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" } `, }, { "empty", map[string]interface{}{"empty": map[string]interface{}{}}, `terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" backend "empty" { } } @@ -48,7 +48,7 @@ func TestAppendRootTerraformBlock_backend(t *testing.T) { "invalid structure", map[string]interface{}{"invalid": "unexpected type"}, `terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" } `, }, { @@ -57,7 +57,7 @@ func TestAppendRootTerraformBlock_backend(t *testing.T) { "path": "relative/path/to/terraform.tfstate", }}, `terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" backend "local" { path = "relative/path/to/terraform.tfstate" } @@ -67,7 +67,7 @@ func TestAppendRootTerraformBlock_backend(t *testing.T) { "consul", consulBackend, `terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" backend "consul" { address = "consul.example.com" ca_file = "ca_cert" @@ -85,7 +85,7 @@ func TestAppendRootTerraformBlock_backend(t *testing.T) { "conn_str": "postgres://user:pass@db.example.com/terraform_backend", }}, `terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" backend "pg" { conn_str = "postgres://user:pass@db.example.com/terraform_backend" } diff --git a/templates/tftmpl/testdata/catalog-services/main.tf b/templates/tftmpl/testdata/catalog-services/main.tf index 9cf123b35..9f64989df 100644 --- a/templates/tftmpl/testdata/catalog-services/main.tf +++ b/templates/tftmpl/testdata/catalog-services/main.tf @@ -9,7 +9,7 @@ # Description: user description for task named 'test' terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" } diff --git a/templates/tftmpl/testdata/main.tf b/templates/tftmpl/testdata/main.tf index 70f9c6982..1b0e405c7 100644 --- a/templates/tftmpl/testdata/main.tf +++ b/templates/tftmpl/testdata/main.tf @@ -9,7 +9,7 @@ # Description: user description for task named 'test' terraform { - required_version = ">= 0.13.0, < 1.3.0" + required_version = ">= 0.13.0, <= 1.6.2" required_providers { testProvider = { source = "namespace/testProvider" From 33512ad84ec5fc0f6e79e60a806c317e681c9df4 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:42:26 +0530 Subject: [PATCH 07/33] go fmt --- config/monitor_services.go | 8 +-- config/task.go | 14 ++--- internal/decode/decode.go | 5 +- mocks/api/middleware.go | 6 +-- mocks/client/consul.go | 54 +++++++++---------- mocks/templates/template.go | 6 +-- mocks/templates/watcher.go | 28 +++++----- templates/hcltmpl/block.go | 4 +- templates/tftmpl/root.go | 4 +- .../tmplfunc/catalog_services_registration.go | 2 +- templates/tftmpl/tmplfunc/services_meta.go | 8 +-- templates/tftmpl/tmplfunc/services_regex.go | 6 ++- testutils/utils.go | 4 +- 13 files changed, 78 insertions(+), 71 deletions(-) diff --git a/config/monitor_services.go b/config/monitor_services.go index e94b30038..c2486d0f2 100644 --- a/config/monitor_services.go +++ b/config/monitor_services.go @@ -131,10 +131,10 @@ func (c *ServicesMonitorConfig) Merge(o MonitorConfig) MonitorConfig { // Finalize ensures there no nil pointers. // // Exception: `Regexp` is never finalized and can potentially be nil. -// - There is a need to distinguish betweeen nil regex (unconfigured regex) and -// empty string regex ("" regex pattern) at Validate(). -// - Setting `Regexp` as an empty string is not idempotent. There is a need to -// call Finalize() and Validate() multiple times. +// - There is a need to distinguish betweeen nil regex (unconfigured regex) and +// empty string regex ("" regex pattern) at Validate(). +// - Setting `Regexp` as an empty string is not idempotent. There is a need to +// call Finalize() and Validate() multiple times. func (c *ServicesMonitorConfig) Finalize() { if c == nil { // config not required, return early return diff --git a/config/task.go b/config/task.go index 29b709749..86f615931 100644 --- a/config/task.go +++ b/config/task.go @@ -465,9 +465,10 @@ func (c *TaskConfig) Validate() error { // ValidateForDriver validates all remaining values and required options that were not checked during // the normal Validate() call. This method is recommended to run after: -// - Finalize() -// - Validate() -// - InheritParentConfig() +// - Finalize() +// - Validate() +// - InheritParentConfig() +// // It is intended to indicate whether a task is safe to be converted into a driver for execution. func (c *TaskConfig) ValidateForDriver() error { if err := c.BufferPeriod.Validate(); err != nil { @@ -643,9 +644,10 @@ func FilterTasks(tasks *TaskConfigs, names []string) (*TaskConfigs, error) { } // validateCondition validates condition block taking into account services list -// - ensure task is configured with a condition (condition block or services -// list) -// - if services list is configured, condition block's monitored variable type +// - ensure task is configured with a condition (condition block or services +// list) +// - if services list is configured, condition block's monitored variable type +// // cannot be services // // Note: checking that a condition block's monitored variable type is different diff --git a/internal/decode/decode.go b/internal/decode/decode.go index b38388e6d..b67ab882a 100644 --- a/internal/decode/decode.go +++ b/internal/decode/decode.go @@ -25,7 +25,8 @@ import ( // Aliases must be lowercase, as keys are compared case-insensitive. // // Example alias tag: -// MyField []string `alias:"old_field_name,otherfieldname"` +// +// MyField []string `alias:"old_field_name,otherfieldname"` // // This hook should ONLY be used to maintain backwards compatibility with // deprecated keys. For new structures use mapstructure struct tags to set the @@ -149,7 +150,7 @@ type mapstructureFieldTags struct { // the target is a slice. This is necessary because this hook would have converted // the initial slices into single values on the first pass. // -// Background +// # Background // // HCL allows for repeated blocks which forces it to store structures // as []map[string]interface{} instead of map[string]interface{}. This is an diff --git a/mocks/api/middleware.go b/mocks/api/middleware.go index 7e9ffd6e6..3f62b6789 100644 --- a/mocks/api/middleware.go +++ b/mocks/api/middleware.go @@ -32,8 +32,8 @@ type Interceptor_Intercept_Call struct { } // Intercept is a helper method to define mock.On call -// - _a0 http.ResponseWriter -// - _a1 *http.Request +// - _a0 http.ResponseWriter +// - _a1 *http.Request func (_e *Interceptor_Expecter) Intercept(_a0 interface{}, _a1 interface{}) *Interceptor_Intercept_Call { return &Interceptor_Intercept_Call{Call: _e.mock.On("Intercept", _a0, _a1)} } @@ -70,7 +70,7 @@ type Interceptor_ShouldIntercept_Call struct { } // ShouldIntercept is a helper method to define mock.On call -// - _a0 *http.Request +// - _a0 *http.Request func (_e *Interceptor_Expecter) ShouldIntercept(_a0 interface{}) *Interceptor_ShouldIntercept_Call { return &Interceptor_ShouldIntercept_Call{Call: _e.mock.On("ShouldIntercept", _a0)} } diff --git a/mocks/client/consul.go b/mocks/client/consul.go index 617538a26..92ec19fa0 100644 --- a/mocks/client/consul.go +++ b/mocks/client/consul.go @@ -43,9 +43,9 @@ type ConsulClientInterface_DeregisterService_Call struct { } // DeregisterService is a helper method to define mock.On call -// - ctx context.Context -// - serviceID string -// - q *api.QueryOptions +// - ctx context.Context +// - serviceID string +// - q *api.QueryOptions func (_e *ConsulClientInterface_Expecter) DeregisterService(ctx interface{}, serviceID interface{}, q interface{}) *ConsulClientInterface_DeregisterService_Call { return &ConsulClientInterface_DeregisterService_Call{Call: _e.mock.On("DeregisterService", ctx, serviceID, q)} } @@ -91,9 +91,9 @@ type ConsulClientInterface_GetHealthChecks_Call struct { } // GetHealthChecks is a helper method to define mock.On call -// - ctx context.Context -// - serviceName string -// - q *api.QueryOptions +// - ctx context.Context +// - serviceName string +// - q *api.QueryOptions func (_e *ConsulClientInterface_Expecter) GetHealthChecks(ctx interface{}, serviceName interface{}, q interface{}) *ConsulClientInterface_GetHealthChecks_Call { return &ConsulClientInterface_GetHealthChecks_Call{Call: _e.mock.On("GetHealthChecks", ctx, serviceName, q)} } @@ -137,8 +137,8 @@ type ConsulClientInterface_GetLicense_Call struct { } // GetLicense is a helper method to define mock.On call -// - ctx context.Context -// - q *api.QueryOptions +// - ctx context.Context +// - q *api.QueryOptions func (_e *ConsulClientInterface_Expecter) GetLicense(ctx interface{}, q interface{}) *ConsulClientInterface_GetLicense_Call { return &ConsulClientInterface_GetLicense_Call{Call: _e.mock.On("GetLicense", ctx, q)} } @@ -193,9 +193,9 @@ type ConsulClientInterface_KVGet_Call struct { } // KVGet is a helper method to define mock.On call -// - ctx context.Context -// - key string -// - q *api.QueryOptions +// - ctx context.Context +// - key string +// - q *api.QueryOptions func (_e *ConsulClientInterface_Expecter) KVGet(ctx interface{}, key interface{}, q interface{}) *ConsulClientInterface_KVGet_Call { return &ConsulClientInterface_KVGet_Call{Call: _e.mock.On("KVGet", ctx, key, q)} } @@ -241,8 +241,8 @@ type ConsulClientInterface_Lock_Call struct { } // Lock is a helper method to define mock.On call -// - l *api.Lock -// - stopCh <-chan struct{} +// - l *api.Lock +// - stopCh <-chan struct{} func (_e *ConsulClientInterface_Expecter) Lock(l interface{}, stopCh interface{}) *ConsulClientInterface_Lock_Call { return &ConsulClientInterface_Lock_Call{Call: _e.mock.On("Lock", l, stopCh)} } @@ -288,7 +288,7 @@ type ConsulClientInterface_LockOpts_Call struct { } // LockOpts is a helper method to define mock.On call -// - opts *api.LockOptions +// - opts *api.LockOptions func (_e *ConsulClientInterface_Expecter) LockOpts(opts interface{}) *ConsulClientInterface_LockOpts_Call { return &ConsulClientInterface_LockOpts_Call{Call: _e.mock.On("LockOpts", opts)} } @@ -334,9 +334,9 @@ type ConsulClientInterface_QueryServices_Call struct { } // QueryServices is a helper method to define mock.On call -// - ctx context.Context -// - filter string -// - q *api.QueryOptions +// - ctx context.Context +// - filter string +// - q *api.QueryOptions func (_e *ConsulClientInterface_Expecter) QueryServices(ctx interface{}, filter interface{}, q interface{}) *ConsulClientInterface_QueryServices_Call { return &ConsulClientInterface_QueryServices_Call{Call: _e.mock.On("QueryServices", ctx, filter, q)} } @@ -373,8 +373,8 @@ type ConsulClientInterface_RegisterService_Call struct { } // RegisterService is a helper method to define mock.On call -// - ctx context.Context -// - s *api.AgentServiceRegistration +// - ctx context.Context +// - s *api.AgentServiceRegistration func (_e *ConsulClientInterface_Expecter) RegisterService(ctx interface{}, s interface{}) *ConsulClientInterface_RegisterService_Call { return &ConsulClientInterface_RegisterService_Call{Call: _e.mock.On("RegisterService", ctx, s)} } @@ -427,9 +427,9 @@ type ConsulClientInterface_SessionCreate_Call struct { } // SessionCreate is a helper method to define mock.On call -// - ctx context.Context -// - se *api.SessionEntry -// - q *api.WriteOptions +// - ctx context.Context +// - se *api.SessionEntry +// - q *api.WriteOptions func (_e *ConsulClientInterface_Expecter) SessionCreate(ctx interface{}, se interface{}, q interface{}) *ConsulClientInterface_SessionCreate_Call { return &ConsulClientInterface_SessionCreate_Call{Call: _e.mock.On("SessionCreate", ctx, se, q)} } @@ -466,10 +466,10 @@ type ConsulClientInterface_SessionRenewPeriodic_Call struct { } // SessionRenewPeriodic is a helper method to define mock.On call -// - initialTTL string -// - id string -// - q *api.WriteOptions -// - doneCh <-chan struct{} +// - initialTTL string +// - id string +// - q *api.WriteOptions +// - doneCh <-chan struct{} func (_e *ConsulClientInterface_Expecter) SessionRenewPeriodic(initialTTL interface{}, id interface{}, q interface{}, doneCh interface{}) *ConsulClientInterface_SessionRenewPeriodic_Call { return &ConsulClientInterface_SessionRenewPeriodic_Call{Call: _e.mock.On("SessionRenewPeriodic", initialTTL, id, q, doneCh)} } @@ -506,7 +506,7 @@ type ConsulClientInterface_Unlock_Call struct { } // Unlock is a helper method to define mock.On call -// - l *api.Lock +// - l *api.Lock func (_e *ConsulClientInterface_Expecter) Unlock(l interface{}) *ConsulClientInterface_Unlock_Call { return &ConsulClientInterface_Unlock_Call{Call: _e.mock.On("Unlock", l)} } diff --git a/mocks/templates/template.go b/mocks/templates/template.go index 52f3daac8..94bcbe863 100644 --- a/mocks/templates/template.go +++ b/mocks/templates/template.go @@ -49,7 +49,7 @@ type Template_Execute_Call struct { } // Execute is a helper method to define mock.On call -// - _a0 hcat.Recaller +// - _a0 hcat.Recaller func (_e *Template_Expecter) Execute(_a0 interface{}) *Template_Execute_Call { return &Template_Execute_Call{Call: _e.mock.On("Execute", _a0)} } @@ -122,7 +122,7 @@ type Template_Notify_Call struct { } // Notify is a helper method to define mock.On call -// - _a0 interface{} +// - _a0 interface{} func (_e *Template_Expecter) Notify(_a0 interface{}) *Template_Notify_Call { return &Template_Notify_Call{Call: _e.mock.On("Notify", _a0)} } @@ -166,7 +166,7 @@ type Template_Render_Call struct { } // Render is a helper method to define mock.On call -// - content []byte +// - content []byte func (_e *Template_Expecter) Render(content interface{}) *Template_Render_Call { return &Template_Render_Call{Call: _e.mock.On("Render", content)} } diff --git a/mocks/templates/watcher.go b/mocks/templates/watcher.go index 841357c68..3dbf767cf 100644 --- a/mocks/templates/watcher.go +++ b/mocks/templates/watcher.go @@ -35,7 +35,7 @@ type Watcher_BufferReset_Call struct { } // BufferReset is a helper method to define mock.On call -// - _a0 hcat.Notifier +// - _a0 hcat.Notifier func (_e *Watcher_Expecter) BufferReset(_a0 interface{}) *Watcher_BufferReset_Call { return &Watcher_BufferReset_Call{Call: _e.mock.On("BufferReset", _a0)} } @@ -72,7 +72,7 @@ type Watcher_Buffering_Call struct { } // Buffering is a helper method to define mock.On call -// - _a0 hcat.Notifier +// - _a0 hcat.Notifier func (_e *Watcher_Expecter) Buffering(_a0 interface{}) *Watcher_Buffering_Call { return &Watcher_Buffering_Call{Call: _e.mock.On("Buffering", _a0)} } @@ -147,7 +147,7 @@ type Watcher_Complete_Call struct { } // Complete is a helper method to define mock.On call -// - _a0 hcat.Notifier +// - _a0 hcat.Notifier func (_e *Watcher_Expecter) Complete(_a0 interface{}) *Watcher_Complete_Call { return &Watcher_Complete_Call{Call: _e.mock.On("Complete", _a0)} } @@ -181,7 +181,7 @@ type Watcher_Deregister_Call struct { } // Deregister is a helper method to define mock.On call -// - ns ...hcat.Notifier +// - ns ...hcat.Notifier func (_e *Watcher_Expecter) Deregister(ns ...interface{}) *Watcher_Deregister_Call { return &Watcher_Deregister_Call{Call: _e.mock.On("Deregister", append([]interface{}{}, ns...)...)} @@ -216,7 +216,7 @@ type Watcher_MarkForSweep_Call struct { } // MarkForSweep is a helper method to define mock.On call -// - notifier hcat.IDer +// - notifier hcat.IDer func (_e *Watcher_Expecter) MarkForSweep(notifier interface{}) *Watcher_MarkForSweep_Call { return &Watcher_MarkForSweep_Call{Call: _e.mock.On("MarkForSweep", notifier)} } @@ -255,7 +255,7 @@ type Watcher_Recaller_Call struct { } // Recaller is a helper method to define mock.On call -// - _a0 hcat.Notifier +// - _a0 hcat.Notifier func (_e *Watcher_Expecter) Recaller(_a0 interface{}) *Watcher_Recaller_Call { return &Watcher_Recaller_Call{Call: _e.mock.On("Recaller", _a0)} } @@ -298,7 +298,7 @@ type Watcher_Register_Call struct { } // Register is a helper method to define mock.On call -// - ns ...hcat.Notifier +// - ns ...hcat.Notifier func (_e *Watcher_Expecter) Register(ns ...interface{}) *Watcher_Register_Call { return &Watcher_Register_Call{Call: _e.mock.On("Register", append([]interface{}{}, ns...)...)} @@ -340,9 +340,9 @@ type Watcher_SetBufferPeriod_Call struct { } // SetBufferPeriod is a helper method to define mock.On call -// - min time.Duration -// - max time.Duration -// - tmplIDs ...string +// - min time.Duration +// - max time.Duration +// - tmplIDs ...string func (_e *Watcher_Expecter) SetBufferPeriod(min interface{}, max interface{}, tmplIDs ...interface{}) *Watcher_SetBufferPeriod_Call { return &Watcher_SetBufferPeriod_Call{Call: _e.mock.On("SetBufferPeriod", append([]interface{}{min, max}, tmplIDs...)...)} @@ -440,7 +440,7 @@ type Watcher_Sweep_Call struct { } // Sweep is a helper method to define mock.On call -// - notifier hcat.IDer +// - notifier hcat.IDer func (_e *Watcher_Expecter) Sweep(notifier interface{}) *Watcher_Sweep_Call { return &Watcher_Sweep_Call{Call: _e.mock.On("Sweep", notifier)} } @@ -479,7 +479,7 @@ type Watcher_WaitCh_Call struct { } // WaitCh is a helper method to define mock.On call -// - _a0 context.Context +// - _a0 context.Context func (_e *Watcher_Expecter) WaitCh(_a0 interface{}) *Watcher_WaitCh_Call { return &Watcher_WaitCh_Call{Call: _e.mock.On("WaitCh", _a0)} } @@ -516,8 +516,8 @@ type Watcher_Watch_Call struct { } // Watch is a helper method to define mock.On call -// - _a0 context.Context -// - _a1 chan string +// - _a0 context.Context +// - _a1 chan string func (_e *Watcher_Expecter) Watch(_a0 interface{}, _a1 interface{}) *Watcher_Watch_Call { return &Watcher_Watch_Call{Call: _e.mock.On("Watch", _a0, _a1)} } diff --git a/templates/hcltmpl/block.go b/templates/hcltmpl/block.go index 6ba743eb7..9ccac401e 100644 --- a/templates/hcltmpl/block.go +++ b/templates/hcltmpl/block.go @@ -16,10 +16,10 @@ type Variables map[string]cty.Value // NamedBlock represents an HCL block with one label and an arbitrary number of // attributes of varying types. // -// block "name" { +// block "name" { // attr = "str" // count = 10 -// } +// } type NamedBlock struct { Name string Variables Variables diff --git a/templates/tftmpl/root.go b/templates/tftmpl/root.go index 16d4d8dae..28b3e293d 100644 --- a/templates/tftmpl/root.go +++ b/templates/tftmpl/root.go @@ -139,7 +139,9 @@ func (d *RootModuleInputData) init() { // InitRootModule generates the root module and writes the following files to // disk. -// always: main.tf, variables.tf, terraform.tfvars.tmpl +// +// always: main.tf, variables.tf, terraform.tfvars.tmpl +// // conditionally: variables.module.tf, providers.tfvars func InitRootModule(input *RootModuleInputData) error { input.init() diff --git a/templates/tftmpl/tmplfunc/catalog_services_registration.go b/templates/tftmpl/tmplfunc/catalog_services_registration.go index d9ace56e5..3a68f0ad5 100644 --- a/templates/tftmpl/tmplfunc/catalog_services_registration.go +++ b/templates/tftmpl/tmplfunc/catalog_services_registration.go @@ -21,7 +21,7 @@ var _ hcatQuery = (*catalogServicesRegistrationQuery)(nil) // services. It queries the Catalog List Services API and supports the query // parameters dc, ns, and node-meta. It also adds an additional layer of // custom functionality on the API response: -// - Adds regex filtering on service name option e.g. "regexp=api" +// - Adds regex filtering on service name option e.g. "regexp=api" // // Endpoint: /v1/catalog/services // Template: {{ catalogServicesRegistration ... }} diff --git a/templates/tftmpl/tmplfunc/services_meta.go b/templates/tftmpl/tmplfunc/services_meta.go index 77c5e8065..3dce04522 100644 --- a/templates/tftmpl/tmplfunc/services_meta.go +++ b/templates/tftmpl/tmplfunc/services_meta.go @@ -10,10 +10,10 @@ import ( // ServicesMeta holds the user-defined metadata for the services of a task. // From task configuration, metadata is provided to a task's services in one // of two ways: -// 1. map of metadata: a map of service-name to metadata so that each service -// has its own unique metadata -// 2. metadata: a set of metadata is shared across all services that a task is -// configured with +// 1. map of metadata: a map of service-name to metadata so that each service +// has its own unique metadata +// 2. metadata: a set of metadata is shared across all services that a task is +// configured with type ServicesMeta struct { // Deprecated in 0.5 // When this happens: when task.services field and associated diff --git a/templates/tftmpl/tmplfunc/services_regex.go b/templates/tftmpl/tmplfunc/services_regex.go index f27d9998f..f6f7e4a5c 100644 --- a/templates/tftmpl/tmplfunc/services_regex.go +++ b/templates/tftmpl/tmplfunc/services_regex.go @@ -34,8 +34,10 @@ var ( // Health API query only. // // Endpoints: -// /v1/catalog/services -// /v1/health/service/:service +// +// /v1/catalog/services +// /v1/health/service/:service +// // Template: {{ servicesRegex regexp= ... }} func servicesRegexFunc(recall hcat.Recaller) interface{} { return func(opts ...string) ([]*dep.HealthService, error) { diff --git a/testutils/utils.go b/testutils/utils.go index 5b0e2e176..92a307e8d 100644 --- a/testutils/utils.go +++ b/testutils/utils.go @@ -317,8 +317,8 @@ func (f roundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { // WaitForHttpStatusChange performs a blocking http call every pollInterval and returns the response // whenever it encounters a StatusCode of newStatus. Any StatusCode other than oldStatus or newStatus // will return an error immediately. It is the caller's responsibility to: -// - prevent an infinite loop by eventually cancelling the context -// - close the response +// - prevent an infinite loop by eventually cancelling the context +// - close the response func WaitForHttpStatusChange(ctx context.Context, pollInterval time.Duration, method, url, body string, oldStatus, newStatus int) (*http.Response, error) { for { select { From ab2acb5c426cb96951de32d68fd59e4032d75d2e Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 11:46:52 +0530 Subject: [PATCH 08/33] fix ut --- version/terraform_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/terraform_test.go b/version/terraform_test.go index 375a17bf4..df778654a 100644 --- a/version/terraform_test.go +++ b/version/terraform_test.go @@ -46,7 +46,7 @@ func TestTerraformConstraint(t *testing.T) { false, }, { "invalid upper bound", - "1.3.0", + "1.6.3", false, }, { "unsupported beta release", From 6aa96124febe51c36a3d0d99acb09f0956c04bd3 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 12:08:56 +0530 Subject: [PATCH 09/33] increase e2e timeout --- e2e/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/utils.go b/e2e/utils.go index dbce94571..26c528510 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -47,7 +47,7 @@ const ( defaultWaitForCheckUpdate = 15 * time.Second // liberal wait time to ensure event doesn't happen - defaultWaitForNoEvent = 6 * time.Second + defaultWaitForNoEvent = 15 * time.Second // default TLS defaultCTSClientCert = "../testutils/certs/localhost_leaf_cert.pem" From 6c98175bbb8dc7dab274521a136a939e489d6094 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 12:16:26 +0530 Subject: [PATCH 10/33] increase time --- e2e/condition_schedule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index 53508bb7f..6b929360e 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -300,7 +300,7 @@ func TestCondition_Schedule_CreateAndDeleteCLI(t *testing.T) { cts := ctsSetup(t, srv, tempDir, initTask) taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute + scheduledWait := taskSchedule + 17*time.Second // buffer for task to execute // Create a scheduled task with the CLI and a task file var taskConfig hclConfig From 8f0c2373fed4848953f0e1e3f48ba69733acde16 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 12:17:21 +0530 Subject: [PATCH 11/33] increate time sleep --- e2e/condition_schedule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index 6b929360e..4745e1e9e 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -300,7 +300,7 @@ func TestCondition_Schedule_CreateAndDeleteCLI(t *testing.T) { cts := ctsSetup(t, srv, tempDir, initTask) taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 17*time.Second // buffer for task to execute + scheduledWait := taskSchedule + 27*time.Second // buffer for task to execute // Create a scheduled task with the CLI and a task file var taskConfig hclConfig From 1fa91b54970885987238f6d73ef4408a227b9f48 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 12:41:47 +0530 Subject: [PATCH 12/33] time --- e2e/condition_schedule_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index 4745e1e9e..a9abd8297 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -299,8 +299,8 @@ func TestCondition_Schedule_CreateAndDeleteCLI(t *testing.T) { tempDir := fmt.Sprintf("%s%s", tempDirPrefix, "schedule_create_delete_cli") cts := ctsSetup(t, srv, tempDir, initTask) - taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 27*time.Second // buffer for task to execute + taskSchedule := 20 * time.Second + scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute // Create a scheduled task with the CLI and a task file var taskConfig hclConfig From fa7a50ac973dbfca1abfbbd1d3cfcf73ab3eeb3b Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 12:48:59 +0530 Subject: [PATCH 13/33] increase wait time --- e2e/condition_schedule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index a9abd8297..360f6b2d9 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -120,7 +120,7 @@ func TestCondition_Schedule_Basic(t *testing.T) { // scheduled time. Check resources are created. port := cts.Port() - taskSchedule := 10 * time.Second + taskSchedule := 20 * time.Second scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute // 0. Confirm at least one event for once-mode From 74aa9441513bf6ccee8e149c5f127dcdd0715e3c Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 12:57:12 +0530 Subject: [PATCH 14/33] increase schedule time --- e2e/condition_schedule_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index 360f6b2d9..7f08c3c55 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -120,8 +120,8 @@ func TestCondition_Schedule_Basic(t *testing.T) { // scheduled time. Check resources are created. port := cts.Port() - taskSchedule := 20 * time.Second - scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute + taskSchedule := 10 * time.Second + scheduledWait := taskSchedule + 27*time.Second // buffer for task to execute // 0. Confirm at least one event for once-mode eventCountBase := eventCount(t, taskName, port) From 545feb97ae26d269ac9a34ef394420f8c2c67fb3 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 13:02:20 +0530 Subject: [PATCH 15/33] increate sleep --- e2e/condition_schedule_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index 7f08c3c55..9c5f8d36e 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -299,8 +299,8 @@ func TestCondition_Schedule_CreateAndDeleteCLI(t *testing.T) { tempDir := fmt.Sprintf("%s%s", tempDirPrefix, "schedule_create_delete_cli") cts := ctsSetup(t, srv, tempDir, initTask) - taskSchedule := 20 * time.Second - scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute + taskSchedule := 10 * time.Second + scheduledWait := taskSchedule + 27*time.Second // buffer for task to execute // Create a scheduled task with the CLI and a task file var taskConfig hclConfig From a55e2dbeef4d5bcb76d127554ac72c095940343e Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 13:20:33 +0530 Subject: [PATCH 16/33] increase time further --- e2e/condition_schedule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index 9c5f8d36e..afa6c50cf 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -121,7 +121,7 @@ func TestCondition_Schedule_Basic(t *testing.T) { port := cts.Port() taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 27*time.Second // buffer for task to execute + scheduledWait := taskSchedule + 37*time.Second // buffer for task to execute // 0. Confirm at least one event for once-mode eventCountBase := eventCount(t, taskName, port) From a7d8049449c9a228a969b8e352ad6b36fa3bb04a Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 13:35:13 +0530 Subject: [PATCH 17/33] fix spacing --- e2e/condition_schedule_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index afa6c50cf..68140e5c7 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -44,7 +44,7 @@ const ( condition "schedule" { cron = "*/10 * * * * * *" } - module_input "services"{ + module_input "services" { regexp = "^web.*|^api.*" } }` @@ -121,7 +121,7 @@ func TestCondition_Schedule_Basic(t *testing.T) { port := cts.Port() taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 37*time.Second // buffer for task to execute + scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute // 0. Confirm at least one event for once-mode eventCountBase := eventCount(t, taskName, port) From ba0c913612c7c3f23b79dd46a749de951b1b9936 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 13:42:13 +0530 Subject: [PATCH 18/33] increate time .sleep --- e2e/condition_schedule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index 68140e5c7..f09dd9378 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -121,7 +121,7 @@ func TestCondition_Schedule_Basic(t *testing.T) { port := cts.Port() taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute + scheduledWait := taskSchedule + 57*time.Second // buffer for task to execute // 0. Confirm at least one event for once-mode eventCountBase := eventCount(t, taskName, port) From 3d9a55d67bb7dc17de615dd652dae9a8c16d6d3e Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 14:54:03 +0530 Subject: [PATCH 19/33] added sleep of 20 secs --- e2e/condition_schedule_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index f09dd9378..c6e56945a 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -69,8 +69,8 @@ func TestCondition_Schedule_Basic(t *testing.T) { condition "schedule" { cron = "*/10 * * * * * *" } -} -`, taskName) + } + `, taskName) moduleInputServices := fmt.Sprintf(scheduledServices, taskName) moduleInputConsulKV := fmt.Sprintf(scheduledConsulKV, taskName) @@ -121,7 +121,7 @@ func TestCondition_Schedule_Basic(t *testing.T) { port := cts.Port() taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 57*time.Second // buffer for task to execute + scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute // 0. Confirm at least one event for once-mode eventCountBase := eventCount(t, taskName, port) @@ -157,6 +157,7 @@ func TestCondition_Schedule_Basic(t *testing.T) { // check scheduled task did not trigger immediately and ran only on schedule api.WaitForEvent(t, cts, taskName, registerTime, scheduledWait) checkScheduledRun(t, taskName, registerTime, taskSchedule, port) + time.Sleep(20 * time.Second) // confirm service resources created resourcesPath := filepath.Join(tempDir, taskName, resourcesDir) From 099d3324325ff6efd561d6a57065023ca2fb78a8 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:02:18 +0530 Subject: [PATCH 20/33] increase sleep --- e2e/condition_schedule_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index c6e56945a..ed577eb07 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -157,7 +157,7 @@ func TestCondition_Schedule_Basic(t *testing.T) { // check scheduled task did not trigger immediately and ran only on schedule api.WaitForEvent(t, cts, taskName, registerTime, scheduledWait) checkScheduledRun(t, taskName, registerTime, taskSchedule, port) - time.Sleep(20 * time.Second) + time.Sleep(defaultWaitForTestReadiness) // confirm service resources created resourcesPath := filepath.Join(tempDir, taskName, resourcesDir) @@ -349,6 +349,8 @@ func TestCondition_Schedule_CreateAndDeleteCLI(t *testing.T) { api.WaitForEvent(t, cts, taskName, registerTime, scheduledWait) checkScheduledRun(t, taskName, registerTime, taskSchedule, port) + time.Sleep(defaultWaitForTestReadiness) + // confirm resources created resourcesPath := filepath.Join(tempDir, taskName, resourcesDir) validateServices(t, true, []string{"api-1", "web-1"}, resourcesPath) From f96145c24c6b6217642f9db0a1af664a50e104d6 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:11:18 +0530 Subject: [PATCH 21/33] revert unwanted change --- e2e/condition_schedule_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/condition_schedule_test.go b/e2e/condition_schedule_test.go index ed577eb07..a8498feb3 100644 --- a/e2e/condition_schedule_test.go +++ b/e2e/condition_schedule_test.go @@ -301,7 +301,7 @@ func TestCondition_Schedule_CreateAndDeleteCLI(t *testing.T) { cts := ctsSetup(t, srv, tempDir, initTask) taskSchedule := 10 * time.Second - scheduledWait := taskSchedule + 27*time.Second // buffer for task to execute + scheduledWait := taskSchedule + 7*time.Second // buffer for task to execute // Create a scheduled task with the CLI and a task file var taskConfig hclConfig From 1c44affa2e3de3748d7bf2871664dc8db3fabed6 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:12:53 +0530 Subject: [PATCH 22/33] revert default wait for no event --- e2e/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/utils.go b/e2e/utils.go index 26c528510..dbce94571 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -47,7 +47,7 @@ const ( defaultWaitForCheckUpdate = 15 * time.Second // liberal wait time to ensure event doesn't happen - defaultWaitForNoEvent = 15 * time.Second + defaultWaitForNoEvent = 6 * time.Second // default TLS defaultCTSClientCert = "../testutils/certs/localhost_leaf_cert.pem" From 6c8a2570225d0a4170ff2ed8c96cd939f4696b53 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:21:39 +0530 Subject: [PATCH 23/33] update go version --- .github/workflows/build.yml | 20 ++++++++++---------- go.mod | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 31ba74323..d692e29fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,15 +71,15 @@ jobs: strategy: matrix: include: - - {go: "1.18", goos: "linux", goarch: "386"} - - {go: "1.18", goos: "linux", goarch: "amd64"} - - {go: "1.18", goos: "linux", goarch: "arm"} - - {go: "1.18", goos: "linux", goarch: "arm64"} - - {go: "1.18", goos: "freebsd", goarch: "386"} - - {go: "1.18", goos: "freebsd", goarch: "amd64"} - - {go: "1.18", goos: "windows", goarch: "386"} - - {go: "1.18", goos: "windows", goarch: "amd64"} - - {go: "1.18", goos: "solaris", goarch: "amd64"} + - {go: "1.20.10", goos: "linux", goarch: "386"} + - {go: "1.20.10", goos: "linux", goarch: "amd64"} + - {go: "1.20.10", goos: "linux", goarch: "arm"} + - {go: "1.20.10", goos: "linux", goarch: "arm64"} + - {go: "1.20.10", goos: "freebsd", goarch: "386"} + - {go: "1.20.10", goos: "freebsd", goarch: "amd64"} + - {go: "1.20.10", goos: "windows", goarch: "386"} + - {go: "1.20.10", goos: "windows", goarch: "amd64"} + - {go: "1.20.10", goos: "solaris", goarch: "amd64"} fail-fast: true name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build @@ -147,7 +147,7 @@ jobs: matrix: goos: [darwin] goarch: ["amd64"] - go: ["1.18"] + go: ["1.20.10"] fail-fast: true name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build diff --git a/go.mod b/go.mod index 90984d1b0..067fd22a7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/consul-terraform-sync -go 1.18 +go 1.20.10 require ( github.com/PaloAltoNetworks/pango v0.5.1 From 1bbccf0a0a27bed0bb233c39b48a37d3332c3016 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:24:12 +0530 Subject: [PATCH 24/33] fix go mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 067fd22a7..937f519a7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/consul-terraform-sync -go 1.20.10 +go 1.20 require ( github.com/PaloAltoNetworks/pango v0.5.1 From f46baf3a37e84965bb4add1b2922924d2bf53ba0 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:46:27 +0530 Subject: [PATCH 25/33] increate time --- e2e/module_input_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/module_input_test.go b/e2e/module_input_test.go index c5b75aad6..7f5da0931 100644 --- a/e2e/module_input_test.go +++ b/e2e/module_input_test.go @@ -394,7 +394,7 @@ func TestModuleInput_ConsulKVCondition(t *testing.T) { service := testutil.TestService{ID: "api", Name: "api"} testutils.RegisterConsulService(t, srv, service, defaultWaitForRegistration) - time.Sleep(defaultWaitForNoEvent) + time.Sleep(defaultWaitForTestReadiness) testutils.CheckDir(t, false, resourcesPath) // 2. Register kv pair to trigger condition. Confirm that From be4067a8017df9fbcddd86fa7ee82333c443bc44 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:47:37 +0530 Subject: [PATCH 26/33] increase wait time --- e2e/condition_service_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/condition_service_test.go b/e2e/condition_service_test.go index 753fb40fa..dd332de7a 100644 --- a/e2e/condition_service_test.go +++ b/e2e/condition_service_test.go @@ -212,7 +212,7 @@ func testServicesCondition(t *testing.T, tc servicesConditionTest) { now = time.Now() service = testutil.TestService{ID: "api-web-3", Name: "api-web", Tags: []string{"tag_a"}} testutils.RegisterConsulService(t, srv, service, defaultWaitForRegistration) - time.Sleep(defaultWaitForNoEvent) + time.Sleep(defaultWaitForTestReadiness) eventCountNow = eventCount(t, tc.taskName, cts.Port()) require.Equal(t, eventCountExpected, eventCountNow, "change in event count. task was unexpectedly triggered") From 5b7dee9ede98635e49a4e16a0c6164ca090e5a2a Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:55:19 +0530 Subject: [PATCH 27/33] increase wait time --- e2e/module_input_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/module_input_test.go b/e2e/module_input_test.go index 7f5da0931..01e3d04ea 100644 --- a/e2e/module_input_test.go +++ b/e2e/module_input_test.go @@ -223,7 +223,7 @@ func testModuleInputBasic(t *testing.T, tc moduleInputTest) { tc.srv.SetKVString(t, "key", "value") tc.srv.SetKVString(t, "key/recurse", "value-recurse") - time.Sleep(defaultWaitForNoEvent) + time.Sleep(defaultWaitForTestReadiness) testutils.CheckDir(t, false, resourcesPath) // 2. Register "web" service to trigger condition. Confirm that From 0715aaacd049c2aa68db2b65557490ef183c94c7 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 15:57:29 +0530 Subject: [PATCH 28/33] increase wait time --- e2e/condition_service_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/condition_service_test.go b/e2e/condition_service_test.go index dd332de7a..3e21fbad9 100644 --- a/e2e/condition_service_test.go +++ b/e2e/condition_service_test.go @@ -188,7 +188,7 @@ func testServicesCondition(t *testing.T, tc servicesConditionTest) { now := time.Now() service = testutil.TestService{ID: "api-web-1", Name: "api-web"} testutils.RegisterConsulService(t, srv, service, defaultWaitForRegistration) - api.WaitForEvent(t, cts, tc.taskName, now, defaultWaitForEvent) + api.WaitForEvent(t, cts, tc.taskName, now, defaultWaitForTestReadiness) eventCountNow = eventCount(t, tc.taskName, cts.Port()) eventCountExpected++ require.Equal(t, eventCountExpected, eventCountNow, @@ -201,7 +201,7 @@ func testServicesCondition(t *testing.T, tc servicesConditionTest) { now = time.Now() service = testutil.TestService{ID: "api-web-2", Name: "api-web"} testutils.RegisterConsulService(t, srv, service, defaultWaitForRegistration) - api.WaitForEvent(t, cts, tc.taskName, now, defaultWaitForEvent) + api.WaitForEvent(t, cts, tc.taskName, now, defaultWaitForTestReadiness) eventCountNow = eventCount(t, tc.taskName, cts.Port()) eventCountExpected++ require.Equal(t, eventCountExpected, eventCountNow, @@ -340,7 +340,7 @@ func TestConditionServices_SuppressTriggers_SharedDependencies(t *testing.T) { now := time.Now() service := testutil.TestService{ID: "api-test", Name: "api-test"} testutils.RegisterConsulService(t, srv, service, defaultWaitForRegistration) - api.WaitForEvent(t, cts, taskName, now, defaultWaitForEvent) + api.WaitForEvent(t, cts, taskName, now, defaultWaitForTestReadiness) count = eventCount(t, taskName, cts.Port()) expectedCount++ assert.Equal(t, expectedCount, count, "unexpected event count") @@ -351,7 +351,7 @@ func TestConditionServices_SuppressTriggers_SharedDependencies(t *testing.T) { now = time.Now() service = testutil.TestService{ID: "web", Name: "web"} testutils.RegisterConsulService(t, srv, service, defaultWaitForRegistration) - api.WaitForEvent(t, cts, initTaskName, now, defaultWaitForEvent) + api.WaitForEvent(t, cts, initTaskName, now, defaultWaitForTestReadiness) initCount := eventCount(t, initTaskName, cts.Port()) assert.Equal(t, 2, initCount, "unexpected event count") initResources := filepath.Join(tempDir, initTaskName, resourcesDir) From 5e3ef992102ef029a2e10fcb1ab41faf914c45a9 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 16:07:01 +0530 Subject: [PATCH 29/33] fix go version in build.yml --- .github/workflows/build.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d692e29fb..cbeb7099a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,15 +71,15 @@ jobs: strategy: matrix: include: - - {go: "1.20.10", goos: "linux", goarch: "386"} - - {go: "1.20.10", goos: "linux", goarch: "amd64"} - - {go: "1.20.10", goos: "linux", goarch: "arm"} - - {go: "1.20.10", goos: "linux", goarch: "arm64"} - - {go: "1.20.10", goos: "freebsd", goarch: "386"} - - {go: "1.20.10", goos: "freebsd", goarch: "amd64"} - - {go: "1.20.10", goos: "windows", goarch: "386"} - - {go: "1.20.10", goos: "windows", goarch: "amd64"} - - {go: "1.20.10", goos: "solaris", goarch: "amd64"} + - {go: "1.20", goos: "linux", goarch: "386"} + - {go: "1.20", goos: "linux", goarch: "amd64"} + - {go: "1.20", goos: "linux", goarch: "arm"} + - {go: "1.20", goos: "linux", goarch: "arm64"} + - {go: "1.20", goos: "freebsd", goarch: "386"} + - {go: "1.20", goos: "freebsd", goarch: "amd64"} + - {go: "1.20", goos: "windows", goarch: "386"} + - {go: "1.20", goos: "windows", goarch: "amd64"} + - {go: "1.20", goos: "solaris", goarch: "amd64"} fail-fast: true name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build @@ -147,7 +147,7 @@ jobs: matrix: goos: [darwin] goarch: ["amd64"] - go: ["1.20.10"] + go: ["1.20"] fail-fast: true name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build From 971ca63add1f6ee37cbb5bfc2aca29f44c661ee6 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 16:08:06 +0530 Subject: [PATCH 30/33] go version fix --- .github/workflows/ci.yml | 2 +- .github/workflows/weekly-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b0dbdee7..24e19d3cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.20.10 + GO_VERSION: 1.20 CONSUL_VERSION: 1.12.1 TERRAFORM_VERSION: 1.2.2 diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index 098baa006..9bf6cdc42 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.20.10 + GO_VERSION: 1.20 CONSUL_VERSION: 1.12.1 TERRAFORM_VERSION: 1.2.2 VAULT_VERSION: 1.10.3 From d6083ec8c2d0398ee50aa0b555ef8155b8009f12 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 16:16:09 +0530 Subject: [PATCH 31/33] revert go version --- .github/workflows/build.yml | 20 ++++++++++---------- .github/workflows/ci.yml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbeb7099a..d692e29fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,15 +71,15 @@ jobs: strategy: matrix: include: - - {go: "1.20", goos: "linux", goarch: "386"} - - {go: "1.20", goos: "linux", goarch: "amd64"} - - {go: "1.20", goos: "linux", goarch: "arm"} - - {go: "1.20", goos: "linux", goarch: "arm64"} - - {go: "1.20", goos: "freebsd", goarch: "386"} - - {go: "1.20", goos: "freebsd", goarch: "amd64"} - - {go: "1.20", goos: "windows", goarch: "386"} - - {go: "1.20", goos: "windows", goarch: "amd64"} - - {go: "1.20", goos: "solaris", goarch: "amd64"} + - {go: "1.20.10", goos: "linux", goarch: "386"} + - {go: "1.20.10", goos: "linux", goarch: "amd64"} + - {go: "1.20.10", goos: "linux", goarch: "arm"} + - {go: "1.20.10", goos: "linux", goarch: "arm64"} + - {go: "1.20.10", goos: "freebsd", goarch: "386"} + - {go: "1.20.10", goos: "freebsd", goarch: "amd64"} + - {go: "1.20.10", goos: "windows", goarch: "386"} + - {go: "1.20.10", goos: "windows", goarch: "amd64"} + - {go: "1.20.10", goos: "solaris", goarch: "amd64"} fail-fast: true name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build @@ -147,7 +147,7 @@ jobs: matrix: goos: [darwin] goarch: ["amd64"] - go: ["1.20"] + go: ["1.20.10"] fail-fast: true name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24e19d3cf..8b0dbdee7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.20 + GO_VERSION: 1.20.10 CONSUL_VERSION: 1.12.1 TERRAFORM_VERSION: 1.2.2 From 0d31023ae93511f18339df483b8e2aac19622ef3 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 16:19:50 +0530 Subject: [PATCH 32/33] fix go version in weekly tests --- .github/workflows/weekly-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weekly-tests.yml b/.github/workflows/weekly-tests.yml index 9bf6cdc42..098baa006 100644 --- a/.github/workflows/weekly-tests.yml +++ b/.github/workflows/weekly-tests.yml @@ -12,7 +12,7 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: 1.20 + GO_VERSION: 1.20.10 CONSUL_VERSION: 1.12.1 TERRAFORM_VERSION: 1.2.2 VAULT_VERSION: 1.10.3 From 83595e4915c67011db1d182346207ccc27ce7c09 Mon Sep 17 00:00:00 2001 From: absolutelightning Date: Fri, 27 Oct 2023 19:54:51 +0530 Subject: [PATCH 33/33] change log --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf4aacec0..f0cf76348 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ BUG FIXES: * Fix issue with re registration of services with checks not triggering task [[GH-1067](https://github.com/hashicorp/consul-terraform-sync/pull/1067)] +FEATURES: +* Go version bump to 1.21.10 [[GH-1067](https://github.com/hashicorp/consul-terraform-sync/pull/1067)] +* Support for Terraform v1.6.2 [[GH-1067](https://github.com/hashicorp/consul-terraform-sync/pull/1067)] + ## 0.7.0 (September 8, 2022) BREAKING CHANGES: