Skip to content

Commit f53e118

Browse files
committed
release: v0.4.18
1 parent 457e209 commit f53e118

File tree

6 files changed

+217
-84
lines changed

6 files changed

+217
-84
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.4.18](https://github.com/Altinity/terraform-provider-altinitycloud/compare/v0.4.17...v0.4.18)
8+
9+
### Added
10+
- Add test cases for `altinitycloud_env_status` models [99c0206](https://github.com/Altinity/terraform-provider-altinitycloud/commit/99c0206).
11+
12+
### Changed
13+
- Bump github.com/hashicorp/terraform-plugin-testing to `1.13.3` [#176](https://github.com/Altinity/terraform-provider-altinitycloud/pull/176).
14+
- Bump github.com/hashicorp/terraform-plugin-testing to `1.15.1` [#173](https://github.com/Altinity/terraform-provider-altinitycloud/pull/173).
15+
- Bump github.com/hashicorp/terraform-plugin-docs to `0.22.0` [#172](https://github.com/Altinity/terraform-provider-altinitycloud/pull/172).
16+
- Bump github.com/Yamashou/gqlgenc to `0.33.0` [#171](https://github.com/Altinity/terraform-provider-altinitycloud/pull/171).
17+
- Sync GraphQL schema with the latest version [2c8002a](https://github.com/Altinity/terraform-provider-altinitycloud/commit/2c8002a).
18+
- Update docs for AWS peering and VPC endpoint examples [457e209](https://github.com/Altinity/terraform-provider-altinitycloud/commit/457e209).
19+
20+
### Fixed
21+
- Update docs distribution on k8s GKE example [30a094e](https://github.com/Altinity/terraform-provider-altinitycloud/commit/30a094e).
22+
- Update zone names in `altinitycloud_gcp_env` resource examples [6217068](https://github.com/Altinity/terraform-provider-altinitycloud/commit/6217068).
23+
- Preserve API response while reordering `node_groups` and `zones` properties [f1e9256](https://github.com/Altinity/terraform-provider-altinitycloud/commit/f1e9256).
24+
725
## [0.4.17](https://github.com/Altinity/terraform-provider-altinitycloud/compare/v0.4.16...v0.4.17)
826
### Fixed
927
- Allow `hcloud_token_enc` to be updated [4cbed8a](https://github.com/Altinity/terraform-provider-altinitycloud/commit/4cbed8a).

internal/provider/env/aws/model_test.go

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestReorderNodeGroups(t *testing.T) {
1717
apiNodeGroups []*sdk.AWSEnvSpecFragment_NodeGroups
1818
expectedOrder []string
1919
expectedLength int
20-
validateData bool // Whether to validate specific field values
20+
validateData bool
2121
}{
2222
{
2323
name: "Preserve model order and add new API node groups",
@@ -28,7 +28,7 @@ func TestReorderNodeGroups(t *testing.T) {
2828
apiNodeGroups: []*sdk.AWSEnvSpecFragment_NodeGroups{
2929
{NodeType: "user", Name: "user-group", CapacityPerZone: 2},
3030
{NodeType: "system", Name: "system-group", CapacityPerZone: 1},
31-
{NodeType: "monitoring", Name: "monitoring-group", CapacityPerZone: 1}, // New node group not in model
31+
{NodeType: "monitoring", Name: "monitoring-group", CapacityPerZone: 1},
3232
},
3333
expectedOrder: []string{"system", "user", "monitoring"},
3434
expectedLength: 3,
@@ -51,7 +51,7 @@ func TestReorderNodeGroups(t *testing.T) {
5151
model: []common.NodeGroupsModel{
5252
{NodeType: types.StringValue("system")},
5353
{NodeType: types.StringValue("user")},
54-
{NodeType: types.StringValue("missing")}, // Not in API
54+
{NodeType: types.StringValue("missing")},
5555
},
5656
apiNodeGroups: []*sdk.AWSEnvSpecFragment_NodeGroups{
5757
{NodeType: "user", Name: "user-group", CapacityPerZone: 2},
@@ -125,9 +125,8 @@ func TestReorderNodeGroups(t *testing.T) {
125125
}
126126
}
127127

128-
// Additional data validation for the "No data loss validation" test case
129128
if tt.validateData {
130-
// Verify system is first (from model order)
129+
131130
if result[0].NodeType != "system" {
132131
t.Errorf("Expected first node type to be 'system', got '%s'", result[0].NodeType)
133132
}
@@ -138,7 +137,6 @@ func TestReorderNodeGroups(t *testing.T) {
138137
t.Errorf("Expected system CapacityPerZone to be 10, got %d", result[0].CapacityPerZone)
139138
}
140139

141-
// Verify other node groups are preserved with their data
142140
nodeTypeToGroup := make(map[string]*sdk.AWSEnvSpecFragment_NodeGroups)
143141
for _, group := range result {
144142
nodeTypeToGroup[group.NodeType] = group
@@ -371,7 +369,7 @@ func TestLoadBalancersToSDK(t *testing.T) {
371369
}
372370

373371
if tt.expected != nil && result != nil {
374-
// Compare public load balancer
372+
375373
if (tt.expected.Public == nil) != (result.Public == nil) {
376374
t.Errorf("Public load balancer presence mismatch")
377375
}
@@ -387,7 +385,6 @@ func TestLoadBalancersToSDK(t *testing.T) {
387385
}
388386
}
389387

390-
// Compare internal load balancer
391388
if (tt.expected.Internal == nil) != (result.Internal == nil) {
392389
t.Errorf("Internal load balancer presence mismatch")
393390
}
@@ -495,7 +492,6 @@ func TestLoadBalancersToModel(t *testing.T) {
495492
return
496493
}
497494

498-
// Test public load balancer
499495
if result.Public == nil {
500496
t.Error("Expected non-nil Public load balancer")
501497
return
@@ -510,7 +506,6 @@ func TestLoadBalancersToModel(t *testing.T) {
510506
t.Errorf("Public SourceIPRanges count: expected %d, got %d", tt.expected.publicSourceIPCount, len(result.Public.SourceIPRanges))
511507
}
512508

513-
// Test internal load balancer
514509
if result.Internal == nil {
515510
t.Error("Expected non-nil Internal load balancer")
516511
return
@@ -747,7 +742,6 @@ func TestNodeGroupsToModel(t *testing.T) {
747742
t.Errorf("Node group %d CapacityPerZone: expected %d, got %d", i, expected.capacityPerZone, result[i].CapacityPerZone.ValueInt64())
748743
}
749744

750-
// Check zones count by converting List to slice
751745
var zones []string
752746
result[i].Zones.ElementsAs(context.TODO(), &zones, false)
753747
if len(zones) != expected.zonesCount {
@@ -825,7 +819,7 @@ func TestAWSEnvResourceModel_toSDK(t *testing.T) {
825819
},
826820
},
827821
validate: func(t *testing.T, create sdk.CreateAWSEnvInput, update sdk.UpdateAWSEnvInput) {
828-
// Validate create input
822+
829823
if create.Name != "test-env" {
830824
t.Errorf("Create name: expected 'test-env', got '%s'", create.Name)
831825
}
@@ -860,7 +854,6 @@ func TestAWSEnvResourceModel_toSDK(t *testing.T) {
860854
t.Errorf("Create tags: expected 1, got %d", len(create.Spec.Tags))
861855
}
862856

863-
// Validate update input
864857
if update.Name != "test-env" {
865858
t.Errorf("Update name: expected 'test-env', got '%s'", update.Name)
866859
}
@@ -1068,54 +1061,47 @@ func TestAWSEnvResourceModel_toModel(t *testing.T) {
10681061
t.Errorf("SpecRevision: expected 42, got %d", model.SpecRevision.ValueInt64())
10691062
}
10701063

1071-
// Check zones
10721064
var zones []string
10731065
model.Zones.ElementsAs(context.TODO(), &zones, false)
10741066
if len(zones) != 3 {
10751067
t.Errorf("Zones count: expected 3, got %d", len(zones))
10761068
}
10771069

1078-
// Check node groups
10791070
if len(model.NodeGroups) != 2 {
10801071
t.Errorf("NodeGroups count: expected 2, got %d", len(model.NodeGroups))
10811072
}
10821073
if model.NodeGroups[0].Name.ValueString() != "system-group" {
10831074
t.Errorf("First node group name: expected 'system-group', got '%s'", model.NodeGroups[0].Name.ValueString())
10841075
}
10851076

1086-
// Check maintenance windows
10871077
if len(model.MaintenanceWindows) != 1 {
10881078
t.Errorf("MaintenanceWindows count: expected 1, got %d", len(model.MaintenanceWindows))
10891079
}
10901080
if model.MaintenanceWindows[0].Name.ValueString() != "weekly-maintenance" {
10911081
t.Errorf("Maintenance window name: expected 'weekly-maintenance', got '%s'", model.MaintenanceWindows[0].Name.ValueString())
10921082
}
10931083

1094-
// Check peering connections
10951084
if len(model.PeeringConnections) != 1 {
10961085
t.Errorf("PeeringConnections count: expected 1, got %d", len(model.PeeringConnections))
10971086
}
10981087
if model.PeeringConnections[0].VpcID.ValueString() != "vpc-12345" {
10991088
t.Errorf("Peering connection VPC ID: expected 'vpc-12345', got '%s'", model.PeeringConnections[0].VpcID.ValueString())
11001089
}
11011090

1102-
// Check endpoints
11031091
if len(model.Endpoints) != 1 {
11041092
t.Errorf("Endpoints count: expected 1, got %d", len(model.Endpoints))
11051093
}
11061094
if model.Endpoints[0].ServiceName.ValueString() != "com.amazonaws.vpce.us-east-1.s3" {
11071095
t.Errorf("Endpoint service name: expected 'com.amazonaws.vpce.us-east-1.s3', got '%s'", model.Endpoints[0].ServiceName.ValueString())
11081096
}
11091097

1110-
// Check tags
11111098
if len(model.Tags) != 2 {
11121099
t.Errorf("Tags count: expected 2, got %d", len(model.Tags))
11131100
}
11141101
if model.Tags[0].Key.ValueString() != "Environment" {
11151102
t.Errorf("First tag key: expected 'Environment', got '%s'", model.Tags[0].Key.ValueString())
11161103
}
11171104

1118-
// Check load balancers
11191105
if model.LoadBalancers == nil {
11201106
t.Fatal("LoadBalancers should not be nil")
11211107
}
@@ -1181,7 +1167,6 @@ func TestAWSEnvResourceModel_toModel(t *testing.T) {
11811167
t.Errorf("SpecRevision: expected 1, got %d", model.SpecRevision.ValueInt64())
11821168
}
11831169

1184-
// Check empty collections
11851170
if len(model.NodeGroups) != 0 {
11861171
t.Errorf("NodeGroups: expected empty slice, got %d items", len(model.NodeGroups))
11871172
}

internal/provider/env/azure/model_test.go

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestReorderNodeGroups(t *testing.T) {
1717
apiNodeGroups []*client.AzureEnvSpecFragment_NodeGroups
1818
expectedOrder []string
1919
expectedLength int
20-
validateData bool // Whether to validate specific field values
20+
validateData bool
2121
}{
2222
{
2323
name: "Preserve model order and add new API node groups",
@@ -28,7 +28,7 @@ func TestReorderNodeGroups(t *testing.T) {
2828
apiNodeGroups: []*client.AzureEnvSpecFragment_NodeGroups{
2929
{NodeType: "user", Name: "user-group", CapacityPerZone: 2},
3030
{NodeType: "system", Name: "system-group", CapacityPerZone: 1},
31-
{NodeType: "monitoring", Name: "monitoring-group", CapacityPerZone: 1}, // New node group not in model
31+
{NodeType: "monitoring", Name: "monitoring-group", CapacityPerZone: 1},
3232
},
3333
expectedOrder: []string{"system", "user", "monitoring"},
3434
expectedLength: 3,
@@ -51,7 +51,7 @@ func TestReorderNodeGroups(t *testing.T) {
5151
model: []common.NodeGroupsModel{
5252
{NodeType: types.StringValue("system")},
5353
{NodeType: types.StringValue("user")},
54-
{NodeType: types.StringValue("missing")}, // Not in API
54+
{NodeType: types.StringValue("missing")},
5555
},
5656
apiNodeGroups: []*client.AzureEnvSpecFragment_NodeGroups{
5757
{NodeType: "user", Name: "user-group", CapacityPerZone: 2},
@@ -125,9 +125,8 @@ func TestReorderNodeGroups(t *testing.T) {
125125
}
126126
}
127127

128-
// Additional data validation for the "No data loss validation" test case
129128
if tt.validateData {
130-
// Verify system is first (from model order)
129+
131130
if result[0].NodeType != "system" {
132131
t.Errorf("Expected first node type to be 'system', got '%s'", result[0].NodeType)
133132
}
@@ -138,7 +137,6 @@ func TestReorderNodeGroups(t *testing.T) {
138137
t.Errorf("Expected system CapacityPerZone to be 10, got %d", result[0].CapacityPerZone)
139138
}
140139

141-
// Verify other node groups are preserved with their data
142140
nodeTypeToGroup := make(map[string]*client.AzureEnvSpecFragment_NodeGroups)
143141
for _, group := range result {
144142
nodeTypeToGroup[group.NodeType] = group
@@ -360,7 +358,7 @@ func TestLoadBalancersToSDK(t *testing.T) {
360358
}
361359

362360
if tt.expected != nil && result != nil {
363-
// Compare public load balancer
361+
364362
if (tt.expected.Public == nil) != (result.Public == nil) {
365363
t.Errorf("Public load balancer presence mismatch")
366364
}
@@ -373,7 +371,6 @@ func TestLoadBalancersToSDK(t *testing.T) {
373371
}
374372
}
375373

376-
// Compare internal load balancer
377374
if (tt.expected.Internal == nil) != (result.Internal == nil) {
378375
t.Errorf("Internal load balancer presence mismatch")
379376
}
@@ -457,7 +454,6 @@ func TestLoadBalancersToModel(t *testing.T) {
457454
return
458455
}
459456

460-
// Test public load balancer
461457
if result.Public == nil {
462458
t.Error("Expected non-nil Public load balancer")
463459
return
@@ -469,7 +465,6 @@ func TestLoadBalancersToModel(t *testing.T) {
469465
t.Errorf("Public SourceIPRanges count: expected %d, got %d", tt.expected.publicSourceIPCount, len(result.Public.SourceIPRanges))
470466
}
471467

472-
// Test internal load balancer
473468
if result.Internal == nil {
474469
t.Error("Expected non-nil Internal load balancer")
475470
return
@@ -700,7 +695,6 @@ func TestNodeGroupsToModel(t *testing.T) {
700695
t.Errorf("Node group %d CapacityPerZone: expected %d, got %d", i, expected.capacityPerZone, result[i].CapacityPerZone.ValueInt64())
701696
}
702697

703-
// Check zones count by converting List to slice
704698
var zones []string
705699
result[i].Zones.ElementsAs(context.TODO(), &zones, false)
706700
if len(zones) != expected.zonesCount {
@@ -763,7 +757,7 @@ func TestAzureEnvResourceModel_toSDK(t *testing.T) {
763757
},
764758
},
765759
validate: func(t *testing.T, create client.CreateAzureEnvInput, update client.UpdateAzureEnvInput) {
766-
// Validate create input
760+
767761
if create.Name != "test-azure-env" {
768762
t.Errorf("Create name: expected 'test-azure-env', got '%s'", create.Name)
769763
}
@@ -798,7 +792,6 @@ func TestAzureEnvResourceModel_toSDK(t *testing.T) {
798792
t.Errorf("Create private link allowed subscriptions: expected 2, got %d", len(create.Spec.PrivateLinkService.AllowedSubscriptions))
799793
}
800794

801-
// Validate update input
802795
if update.Name != "test-azure-env" {
803796
t.Errorf("Update name: expected 'test-azure-env', got '%s'", update.Name)
804797
}
@@ -972,38 +965,33 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
972965
t.Errorf("LoadBalancingStrategy: expected 'ROUND_ROBIN', got '%s'", model.LoadBalancingStrategy.ValueString())
973966
}
974967

975-
// Check zones
976968
var zones []string
977969
model.Zones.ElementsAs(context.TODO(), &zones, false)
978970
if len(zones) != 3 {
979971
t.Errorf("Zones count: expected 3, got %d", len(zones))
980972
}
981973

982-
// Check node groups
983974
if len(model.NodeGroups) != 2 {
984975
t.Errorf("NodeGroups count: expected 2, got %d", len(model.NodeGroups))
985976
}
986977
if model.NodeGroups[0].Name.ValueString() != "system-group" {
987978
t.Errorf("First node group name: expected 'system-group', got '%s'", model.NodeGroups[0].Name.ValueString())
988979
}
989980

990-
// Check maintenance windows
991981
if len(model.MaintenanceWindows) != 1 {
992982
t.Errorf("MaintenanceWindows count: expected 1, got %d", len(model.MaintenanceWindows))
993983
}
994984
if model.MaintenanceWindows[0].Name.ValueString() != "weekly-maintenance" {
995985
t.Errorf("Maintenance window name: expected 'weekly-maintenance', got '%s'", model.MaintenanceWindows[0].Name.ValueString())
996986
}
997987

998-
// Check tags
999988
if len(model.Tags) != 2 {
1000989
t.Errorf("Tags count: expected 2, got %d", len(model.Tags))
1001990
}
1002991
if model.Tags[0].Key.ValueString() != "Environment" {
1003992
t.Errorf("First tag key: expected 'Environment', got '%s'", model.Tags[0].Key.ValueString())
1004993
}
1005994

1006-
// Check load balancers
1007995
if model.LoadBalancers == nil {
1008996
t.Fatal("LoadBalancers should not be nil")
1009997
}
@@ -1014,7 +1002,6 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
10141002
t.Errorf("Public load balancer enabled: expected true, got %v", model.LoadBalancers.Public.Enabled.ValueBool())
10151003
}
10161004

1017-
// Check private link service
10181005
if model.PrivateLinkService == nil {
10191006
t.Fatal("PrivateLinkService should not be nil")
10201007
}
@@ -1069,7 +1056,6 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
10691056
t.Errorf("SubscriptionID: expected 'subscription-min', got '%s'", model.SubscriptionID.ValueString())
10701057
}
10711058

1072-
// Check empty collections
10731059
if len(model.NodeGroups) != 0 {
10741060
t.Errorf("NodeGroups: expected empty slice, got %d items", len(model.NodeGroups))
10751061
}
@@ -1125,7 +1111,6 @@ func TestAzureEnvResourceModel_toModel(t *testing.T) {
11251111
t.Errorf("LoadBalancingStrategy: expected 'ROUND_ROBIN', got '%s'", model.LoadBalancingStrategy.ValueString())
11261112
}
11271113

1128-
// Check zones
11291114
var zones []string
11301115
model.Zones.ElementsAs(context.TODO(), &zones, false)
11311116
if len(zones) != 2 {

0 commit comments

Comments
 (0)