@@ -7850,114 +7850,7 @@ func Test_Sync_SkipConsumersWithConsumerGroups_Konnect(t *testing.T) {
7850
7850
}
7851
7851
7852
7852
func Test_Sync_Partials_Plugins (t * testing.T ) {
7853
- runWhen (t , "enterprise" , ">=3.10.0" )
7854
-
7855
- client , err := getTestClient ()
7856
- require .NoError (t , err )
7857
-
7858
- ctx := context .Background ()
7859
-
7860
- dumpConfig := deckDump.Config {}
7861
-
7862
- partialConfig := kong.Configuration {
7863
- "cluster_max_redirections" : float64 (5 ),
7864
- "cluster_nodes" : nil ,
7865
- "connect_timeout" : float64 (2000 ),
7866
- "connection_is_proxied" : bool (false ),
7867
- "database" : float64 (0 ),
7868
- "host" : string ("127.0.0.1" ),
7869
- "keepalive_backlog" : nil ,
7870
- "keepalive_pool_size" : float64 (256 ),
7871
- "password" : nil ,
7872
- "port" : float64 (6379 ),
7873
- "read_timeout" : float64 (3001 ),
7874
- "send_timeout" : float64 (2004 ),
7875
- "sentinel_master" : nil ,
7876
- "sentinel_nodes" : nil ,
7877
- "sentinel_password" : nil ,
7878
- "sentinel_role" : nil ,
7879
- "sentinel_username" : nil ,
7880
- "server_name" : nil ,
7881
- "ssl" : bool (false ),
7882
- "ssl_verify" : bool (false ),
7883
- "username" : nil ,
7884
- }
7885
-
7886
- t .Run ("create a partial and link to a plugin via name" , func (t * testing.T ) {
7887
- require .NoError (t , sync (ctx , "testdata/sync/039-partials/kong.yaml" ))
7888
- t .Cleanup (func () {
7889
- reset (t )
7890
- })
7891
-
7892
- newState , err := fetchCurrentState (ctx , client , dumpConfig , t )
7893
- require .NoError (t , err )
7894
-
7895
- // check for partial
7896
- partials , err := newState .Partials .GetAll ()
7897
- require .NoError (t , err )
7898
- require .NotNil (t , partials )
7899
-
7900
- require .Len (t , partials , 1 )
7901
- assert .Equal (t , "my-ee-partial" , * partials [0 ].Name )
7902
- assert .Equal (t , "redis-ee" , * partials [0 ].Type )
7903
- assert .IsType (t , kong.Configuration {}, partials [0 ].Config )
7904
- assert .Equal (t , partialConfig , partials [0 ].Config )
7905
-
7906
- // check for plugin
7907
- plugins , err := newState .Plugins .GetAll ()
7908
- require .NoError (t , err )
7909
- require .NotNil (t , plugins )
7910
- require .Len (t , plugins , 1 )
7911
- assert .Equal (t , "rate-limiting-advanced" , * plugins [0 ].Name )
7912
- assert .IsType (t , []* kong.PartialLink {}, plugins [0 ].Partials )
7913
- require .Len (t , plugins [0 ].Partials , 1 )
7914
- assert .Equal (t , * partials [0 ].ID , * plugins [0 ].Partials [0 ].ID )
7915
- assert .Equal (t , "config.redis" , * plugins [0 ].Partials [0 ].Path )
7916
- })
7917
-
7918
- t .Run ("partial id is preserved if passed and linking can be done via id" , func (t * testing.T ) {
7919
- require .NoError (t , sync (ctx , "testdata/sync/039-partials/kong-ids.yaml" ))
7920
- t .Cleanup (func () {
7921
- reset (t )
7922
- })
7923
-
7924
- newState , err := fetchCurrentState (ctx , client , dumpConfig , t )
7925
- require .NoError (t , err )
7926
-
7927
- // check for partial
7928
- partials , err := newState .Partials .GetAll ()
7929
- require .NoError (t , err )
7930
- require .NotNil (t , partials )
7931
-
7932
- require .Len (t , partials , 1 )
7933
- assert .Equal (t , "13dc230d-d65e-439a-9f05-9fd71abfee4d" , * partials [0 ].ID )
7934
- assert .Equal (t , "my-ee-partial" , * partials [0 ].Name )
7935
- assert .Equal (t , "redis-ee" , * partials [0 ].Type )
7936
- assert .IsType (t , kong.Configuration {}, partials [0 ].Config )
7937
- assert .Equal (t , partialConfig , partials [0 ].Config )
7938
-
7939
- // check for plugin
7940
- plugins , err := newState .Plugins .GetAll ()
7941
- require .NoError (t , err )
7942
- require .NotNil (t , plugins )
7943
- require .Len (t , plugins , 1 )
7944
- assert .Equal (t , "rate-limiting-advanced" , * plugins [0 ].Name )
7945
- assert .IsType (t , []* kong.PartialLink {}, plugins [0 ].Partials )
7946
- require .Len (t , plugins [0 ].Partials , 1 )
7947
- assert .Equal (t , "13dc230d-d65e-439a-9f05-9fd71abfee4d" , * plugins [0 ].Partials [0 ].ID )
7948
- assert .Equal (t , "config.redis" , * plugins [0 ].Partials [0 ].Path )
7949
- })
7950
-
7951
- t .Run ("linking to a plugin fails in case of non-existent partial" , func (t * testing.T ) {
7952
- err := sync (ctx , "testdata/sync/039-partials/kong-wrong.yaml" )
7953
- require .Error (t , err )
7954
- assert .ErrorContains (t , err , "partial non-existent-partial for plugin rate-limiting-advanced: entity not found" )
7955
- })
7956
- }
7957
-
7958
- func Test_Sync_Partials_Plugins_Konnect (t * testing.T ) {
7959
- runWhen (t , "konnect" , "" )
7960
- setDefaultKonnectControlPlane (t )
7853
+ runWhenEnterpriseOrKonnect (t , ">=3.10.0" )
7961
7854
7962
7855
client , err := getTestClient ()
7963
7856
require .NoError (t , err )
@@ -7988,7 +7881,6 @@ func Test_Sync_Partials_Plugins_Konnect(t *testing.T) {
7988
7881
"ssl" : bool (false ),
7989
7882
"ssl_verify" : bool (false ),
7990
7883
"username" : nil ,
7991
- "timeout" : float64 (2000 ),
7992
7884
}
7993
7885
7994
7886
t .Run ("create a partial and link to a plugin via name" , func (t * testing.T ) {
0 commit comments