Skip to content

Commit 38f1d9a

Browse files
committed
refactor controller hooks/tests
1 parent d7e75a4 commit 38f1d9a

File tree

77 files changed

+2872
-11672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2872
-11672
lines changed

Makefile

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ SHELL := /bin/bash # Use bash syntax
33
# Set up variables
44
GO111MODULE=on
55

6-
AWS_SDK_GO_VERSION="$(shell echo $(shell go list -m -f '{{.Version}}' github.com/aws/aws-sdk-go))"
7-
AWS_SDK_GO_VERSIONED_PATH="$(shell echo github.com/aws/aws-sdk-go@$(AWS_SDK_GO_VERSION))"
8-
ELASTICACHE_API_PATH="$(shell echo $(shell go env GOPATH))/pkg/mod/$(AWS_SDK_GO_VERSIONED_PATH)/service/elasticache/elasticacheiface"
9-
SERVICE_CONTROLLER_SRC_PATH="$(shell pwd)"
10-
116
# Build ldflags
127
VERSION ?= "v0.0.0"
138
GITCOMMIT=$(shell git rev-parse HEAD)
@@ -16,34 +11,22 @@ GO_LDFLAGS=-ldflags "-X main.version=$(VERSION) \
1611
-X main.buildHash=$(GITCOMMIT) \
1712
-X main.buildDate=$(BUILDDATE)"
1813

19-
.PHONY: all test local-test clean-mocks mocks
14+
.PHONY: all test local-test
2015

2116
all: test
2217

23-
test: | mocks ## Run code tests
24-
go test -v ./...
18+
local-run-controller: ## Run a controller image locally for SERVICE
19+
@go run ./cmd/controller/main.go \
20+
--aws-region=us-west-2 \
21+
--enable-development-logging \
22+
--log-level=debug
2523

26-
test-cover: | mocks ## Run code tests with resources coverage
27-
go test -coverpkg=./pkg/resource/... -covermode=count -coverprofile=coverage.out ./...
28-
go tool cover -func=coverage.out
24+
test: ## Run code tests
25+
go test -v ./...
2926

30-
local-test: | mocks ## Run code tests using go.local.mod file
27+
local-test: ## Run code tests using go.local.mod file
3128
go test -modfile=go.local.mod -v ./...
3229

33-
clean-mocks: ## Remove mocks directory
34-
rm -rf mocks
35-
36-
install-mockery:
37-
@scripts/install-mockery.sh
38-
39-
mocks: install-mockery ## Build mocks
40-
go get -d $(AWS_SDK_GO_VERSIONED_PATH)
41-
@echo "building mocks for $(ELASTICACHE_API_PATH) ... "
42-
@pushd $(ELASTICACHE_API_PATH) 1>/dev/null; \
43-
$(SERVICE_CONTROLLER_SRC_PATH)/bin/mockery --all --dir=. --output=$(SERVICE_CONTROLLER_SRC_PATH)/mocks/aws-sdk-go/elasticache/ ; \
44-
popd 1>/dev/null;
45-
@echo "ok."
46-
4730
help: ## Show this help.
4831
@grep -F -h "##" $(MAKEFILE_LIST) | grep -F -v grep | sed -e 's/\\$$//' \
49-
| awk -F'[:#]' '{print $$1 = sprintf("%-30s", $$1), $$4}'
32+
| awk -F'[:#]' '{print $$1 = sprintf("%-30s", $$1), $$4}'

OWNERS_ALIASES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ aliases:
66
- jaypipes
77
- mhausenblas
88
- a-hilaly
9+
- rushmash91
910
- RedbackThomson
1011
- vijtrip2
1112
# TODO: Add your team members to your team controller alias
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-02-07T19:16:11Z"
2+
build_date: "2025-02-13T22:26:33Z"
33
build_hash: 3d74f13b9de7134b4c76ab7526a9c578c4857602
44
go_version: go1.23.4
55
version: v0.41.0-18-g3d74f13
6-
api_directory_checksum: eb643965cba3c68f76c1b45f100874d07d39c935
6+
api_directory_checksum: 237c52116a1a4d7e014ca4030f65678949b45f88
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: 3c359b3f45716af86c99ab2ea0f2ab50eeae5dc9
10+
file_checksum: f8bc0b6a1a653d39164ae443a23f8bf03b85604e
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/cache_subnet_group.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ resources:
3737
add_synced_column: true
3838
order_by: index
3939
additional_columns:
40-
- name: VERSION
41-
json_path: .spec.engineVersion
42-
type: string
43-
index: 10
44-
- name: STATUS
45-
json_path: .status.cacheClusterStatus
46-
type: string
47-
index: 20
48-
- name: ENDPOINT
49-
json_path: .status.configurationEndpoint.address
50-
type: string
51-
index: 30
52-
priority: 1
40+
- name: VERSION
41+
json_path: .spec.engineVersion
42+
type: string
43+
index: 10
44+
- name: STATUS
45+
json_path: .status.cacheClusterStatus
46+
type: string
47+
index: 20
48+
- name: ENDPOINT
49+
json_path: .status.configurationEndpoint.address
50+
type: string
51+
index: 30
52+
priority: 1
5353
exceptions:
5454
errors:
5555
404:
@@ -173,6 +173,7 @@ resources:
173173
PrimaryClusterId: # note: "PrimaryClusterID" will not function properly
174174
compare:
175175
is_ignored: true
176+
176177
hooks:
177178
sdk_read_many_post_set_output:
178179
template_path: hooks/replication_group/sdk_read_many_post_set_output.go.tpl
@@ -189,7 +190,7 @@ resources:
189190
sdk_file_end:
190191
template_path: hooks/replication_group/sdk_file_end.go.tpl
191192
sdk_file_end_set_output_post_populate:
192-
code: "rm.customSetOutput(obj, ko) // custom set output from obj"
193+
template_path: hooks/replication_group/sdk_file_end_set_output_post_populate.go.tpl
193194
renames:
194195
operations:
195196
CreateReplicationGroup:
@@ -303,7 +304,7 @@ operations:
303304
custom_implementation: CustomModifyReplicationGroup
304305
set_output_custom_method_name: CustomModifyReplicationGroupSetOutput
305306
override_values:
306-
ApplyImmediately: true
307+
ApplyImmediately: aws.Bool(true)
307308
CreateSnapshot:
308309
custom_implementation: CustomCreateSnapshot
309310
set_output_custom_method_name: CustomCreateSnapshotSetOutput
@@ -327,7 +328,7 @@ operations:
327328
ModifyCacheCluster:
328329
set_output_custom_method_name: customModifyCacheClusterSetOutput
329330
override_values:
330-
ApplyImmediately: true
331+
ApplyImmediately: aws.Bool(true)
331332
ignore:
332333
resource_names:
333334
- ServerlessCache
@@ -348,4 +349,27 @@ ignore:
348349
- CreateReplicationGroupInput.AutoMinorVersionUpgrade
349350
- CreateReplicationGroupInput.NumCacheClusters
350351
- CacheCluster.LogDeliveryConfigurations
351-
- PendingModifiedValues.LogDeliveryConfigurations
352+
- PendingModifiedValues.LogDeliveryConfigurations
353+
- CreateUserInput.AuthenticationMode
354+
- ModifyUserInput.AuthenticationMode
355+
- CreateCacheSubnetGroupOutput.CacheSubnetGroup.SupportedNetworkTypes
356+
- CreateCacheSubnetGroupOutput.CacheSubnetGroup.Subnets.SupportedNetworkTypes
357+
- ModifyCacheSubnetGroupOutput.CacheSubnetGroup.Subnets.SupportedNetworkTypes
358+
- CreateUserGroupOutput.ServerlessCaches
359+
- CreateReplicationGroupOutput.ReplicationGroup.PendingModifiedValues.TransitEncryptionEnabled
360+
- CreateReplicationGroupOutput.ReplicationGroup.TransitEncryptionEnabled
361+
- ModifyReplicationGroupInput.TransitEncryptionEnabled
362+
- CreateReplicationGroupInput.TransitEncryptionEnabled
363+
- CreateReplicationGroupOutput.ReplicationGroup.PendingModifiedValues.TransitEncryptionMode
364+
- CreateReplicationGroupOutput.ReplicationGroup.TransitEncryptionMode
365+
- CreateReplicationGroupInput.TransitEncryptionMode
366+
- ModifyReplicationGroupOutput.ReplicationGroup.PendingModifiedValues.TransitEncryptionMode
367+
- CreateReplicationGroupOutput.ReplicationGroup.ClusterMode
368+
- CreateReplicationGroupOutput.ReplicationGroup.PendingModifiedValues.ClusterMode
369+
- CreateReplicationGroupInput.ClusterMode
370+
- ModifyReplicationGroupOutput.ReplicationGroup.ClusterMode
371+
- ModifyReplicationGroupOutput.ReplicationGroup.PendingModifiedValues.ClusterMode
372+
- CreateReplicationGroupInput.ipDiscovery
373+
- CreateReplicationGroupOutput.ReplicationGroup.IpDiscovery
374+
# - ModifyReplicationGroupOutput.ReplicationGroup.ipDiscovery
375+
# - ModifyReplicationGroupInput.ipDiscovery

apis/v1alpha1/replication_group.go

Lines changed: 0 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/types.go

Lines changed: 1 addition & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/user.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/user_group.go

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)