Skip to content

Commit

Permalink
fix: test assertion types
Browse files Browse the repository at this point in the history
Assertions broke after updating to generated client. Example error:

  2024/09/04 13:59:02 Operation "verify default/test-3le9gf7-opensearch is running" succeeded
  opensearch_test.go:82:
        Error Trace:	/home/runner/work/aiven-operator/aiven-operator/tests/opensearch_test.go:82
        Error:      	Not equal:
                      expected: int(245760)
                      actual  : *float64((*float64)(0xc00139a848))
        Test:       	TestOpenSearch
  • Loading branch information
rriski committed Sep 5, 2024
1 parent 8c8a380 commit 998cee8
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestCassandra(t *testing.T) {
assert.Equal(t, csAvn.Plan, cs.Spec.Plan)
assert.Equal(t, csAvn.CloudName, cs.Spec.CloudName)
assert.Equal(t, "450GiB", cs.Spec.DiskSpace)
assert.Equal(t, 460800, csAvn.DiskSpaceMb)
assert.Equal(t, float64(460800), *csAvn.DiskSpaceMb)
assert.Equal(t, map[string]string{"env": "test", "instance": "foo"}, cs.Spec.Tags)
csResp, err := avnClient.ServiceTags.Get(ctx, cfg.Project, name)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestKafka(t *testing.T) {
assert.Equal(t, ksAvn.Plan, ks.Spec.Plan)
assert.Equal(t, ksAvn.CloudName, ks.Spec.CloudName)
assert.Equal(t, "600GiB", ks.Spec.DiskSpace)
assert.Equal(t, 614400, ksAvn.DiskSpaceMb)
assert.Equal(t, float64(614400), *ksAvn.DiskSpaceMb)
assert.Equal(t, map[string]string{"env": "test", "instance": "foo"}, ks.Spec.Tags)
ksResp, err := avnClient.ServiceTags.Get(ctx, cfg.Project, name)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion tests/kafka_with_projectvpc_ref_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestKafkaWithProjectVPCRef(t *testing.T) {
// Validates VPC
require.NotNil(t, kafka.Spec.ProjectVPCRef)
assert.Equal(t, vpcName, kafka.Spec.ProjectVPCRef.Name)
assert.Equal(t, anyPointer(vpc.Status.ID), kafkaAvn.ProjectVpcId)
assert.Equal(t, vpc.Status.ID, kafkaAvn.ProjectVpcId)

vpcAvn, err := avnClient.VPCs.Get(ctx, cfg.Project, vpc.Status.ID)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion tests/kafkschemaregistryacl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestKafkaSchemaRegistryACL(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, kafkaAvn.ServiceName, kafka.GetName())
assert.Equal(t, serviceRunningState, kafka.Status.State)
assert.Contains(t, serviceRunningStatesAiven, string(kafkaAvn.State))
assert.Contains(t, serviceRunningStatesAiven, kafkaAvn.State)
assert.Equal(t, kafkaAvn.Plan, kafka.Spec.Plan)
assert.Equal(t, kafkaAvn.CloudName, kafka.Spec.CloudName)

Expand Down
2 changes: 1 addition & 1 deletion tests/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestMySQL(t *testing.T) {
assert.Equal(t, msAvn.Plan, ms.Spec.Plan)
assert.Equal(t, msAvn.CloudName, ms.Spec.CloudName)
assert.Equal(t, "100GiB", ms.Spec.DiskSpace)
assert.Equal(t, 102400, msAvn.DiskSpaceMb)
assert.Equal(t, float64(102400), *msAvn.DiskSpaceMb)
assert.Equal(t, map[string]string{"env": "test", "instance": "foo"}, ms.Spec.Tags)
msResp, err := avnClient.ServiceTags.Get(ctx, cfg.Project, name)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion tests/opensearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestOpenSearch(t *testing.T) {
assert.Equal(t, osAvn.Plan, os.Spec.Plan)
assert.Equal(t, osAvn.CloudName, os.Spec.CloudName)
assert.Equal(t, "240GiB", os.Spec.DiskSpace)
assert.Equal(t, 245760, osAvn.DiskSpaceMb)
assert.Equal(t, float64(245760), *osAvn.DiskSpaceMb)
assert.Equal(t, map[string]string{"env": "test", "instance": "foo"}, os.Spec.Tags)
osResp, err := avnClient.ServiceTags.Get(ctx, cfg.Project, name)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion tests/projectvpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestProjectVPCID(t *testing.T) {

// Validates VPC
assert.Equal(t, vpc1.Status.ID, kafka.Spec.ProjectVPCID)
assert.Equal(t, anyPointer(vpc1.Status.ID), kafkaAvn.ProjectVpcId)
assert.Equal(t, vpc1.Status.ID, kafkaAvn.ProjectVpcId)

// Migrates the service to vpc2
kafkaYamlUpd := getKafkaForProjectVPCYaml(cfg.Project, vpc2.Status.ID, kafkaName, cfg.TertiaryCloudName)
Expand Down
4 changes: 2 additions & 2 deletions tests/serviceintegration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestServiceIntegrationClickhousePostgreSQL(t *testing.T) {
assert.Contains(t, serviceRunningStatesAiven, chAvn.State)
assert.Equal(t, chAvn.Plan, ch.Spec.Plan)
assert.Equal(t, chAvn.CloudName, ch.Spec.CloudName)
assert.Equal(t, chAvn.Maintenance.Dow, ch.Spec.MaintenanceWindowDow)
assert.Equal(t, string(chAvn.Maintenance.Dow), ch.Spec.MaintenanceWindowDow)
assert.Equal(t, chAvn.Maintenance.Time, ch.Spec.MaintenanceWindowTime)

// Validates PostgreSQL
Expand All @@ -69,7 +69,7 @@ func TestServiceIntegrationClickhousePostgreSQL(t *testing.T) {
assert.Contains(t, serviceRunningStatesAiven, pgAvn.State)
assert.Equal(t, pgAvn.Plan, pg.Spec.Plan)
assert.Equal(t, pgAvn.CloudName, pg.Spec.CloudName)
assert.Equal(t, pgAvn.Maintenance.Dow, pg.Spec.MaintenanceWindowDow)
assert.Equal(t, string(pgAvn.Maintenance.Dow), pg.Spec.MaintenanceWindowDow)
assert.Equal(t, pgAvn.Maintenance.Time, pg.Spec.MaintenanceWindowTime)

// Validates ServiceIntegration
Expand Down

0 comments on commit 998cee8

Please sign in to comment.