Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of APIGW Normalize Status Conditions into release/1.15.x #17844

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
APIGW Normalize Status Conditions (#16994)
* normalize status conditions for gateways and routes

* Added tests for checking condition status and panic conditions for
validating combinations, added dummy code for fsm store

* get rid of unneeded gateway condition generator struct

* Remove unused file

* run go mod tidy

* Update tests, add conflicted gateway status

* put back removed status for test

* Fix linting violation, remove custom conflicted status

* Update fsm commands oss

* Fix incorrect combination of type/condition/status

* cleaning up from PR review

* Change "invalidCertificate" to be of accepted status

* Move status condition enums into api package

* Update gateways controller and generated code

* Update conditions in fsm oss tests

* run go mod tidy on consul-container module to fix linting

* Fix type for gateway endpoint test

* go mod tidy from changes to api

* go mod tidy on troubleshoot

* Fix route conflicted reason

* fix route conflict reason rename

* Fix text for gateway conflicted status

* Add valid certificate ref condition setting

* Revert change to resolved refs to be handled in future PR
  • Loading branch information
jm96441n authored and nathancoleman committed Jun 23, 2023
commit ad67dae6f72ba1f63a771e930e61be17af5162d2
21 changes: 11 additions & 10 deletions agent/consul/fsm/commands_oss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ import (
"testing"
"time"

"github.com/hashicorp/go-raftchunking"
raftchunkingtypes "github.com/hashicorp/go-raftchunking/types"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/raft"
"github.com/hashicorp/serf/coordinate"
"github.com/mitchellh/mapstructure"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -23,6 +18,11 @@ import (
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/sdk/testutil"
"github.com/hashicorp/consul/types"
"github.com/hashicorp/go-raftchunking"
raftchunkingtypes "github.com/hashicorp/go-raftchunking/types"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/raft"
"github.com/hashicorp/serf/coordinate"
)

func generateUUID() (ret string) {
Expand Down Expand Up @@ -1361,9 +1361,10 @@ func TestFSM_ConfigEntry_StatusCAS(t *testing.T) {
EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(),
Status: structs.Status{
Conditions: []structs.Condition{{
Status: "Foo",
Status: string(api.ConditionStatusTrue),
}},
}}
},
}

// Create a new request.
req := &structs.ConfigEntryRequest{
Expand Down Expand Up @@ -1392,7 +1393,7 @@ func TestFSM_ConfigEntry_StatusCAS(t *testing.T) {
// do a status update
entry.Status = structs.Status{
Conditions: []structs.Condition{{
Status: "Foo",
Status: string(api.ConditionStatusTrue),
}},
}
req = &structs.ConfigEntryRequest{
Expand All @@ -1416,7 +1417,7 @@ func TestFSM_ConfigEntry_StatusCAS(t *testing.T) {
entry.RaftIndex.ModifyIndex = 2
conditions := config.(*structs.APIGatewayConfigEntry).Status.Conditions
require.Len(t, conditions, 1)
require.Equal(t, "Foo", conditions[0].Status)
require.Equal(t, string(api.ConditionStatusTrue), conditions[0].Status)
}

// attempt to change the status with a regular update and make sure it's ignored
Expand Down Expand Up @@ -1445,7 +1446,7 @@ func TestFSM_ConfigEntry_StatusCAS(t *testing.T) {
require.NoError(t, err)
conditions := config.(*structs.APIGatewayConfigEntry).Status.Conditions
require.Len(t, conditions, 1)
require.Equal(t, "Foo", conditions[0].Status)
require.Equal(t, string(api.ConditionStatusTrue), conditions[0].Status)
}
}

Expand Down
77 changes: 0 additions & 77 deletions agent/consul/fsm_data_store.go

This file was deleted.

Loading