@@ -7,10 +7,12 @@ import (
7
7
"github.com/go-test/deep"
8
8
"github.com/google/go-cmp/cmp"
9
9
configv1 "github.com/openshift/api/config/v1"
10
+ consolev1 "github.com/openshift/api/console/v1"
10
11
v1 "github.com/openshift/api/operator/v1"
11
12
"github.com/openshift/console-operator/pkg/api"
12
13
authorizationv1 "k8s.io/api/authorization/v1"
13
14
corev1 "k8s.io/api/core/v1"
15
+ metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
14
16
)
15
17
16
18
// defaultTestCapabilities represents the default capabilities as defined in the operator manifest
@@ -907,6 +909,56 @@ func TestConsoleServerCLIConfigBuilder(t *testing.T) {
907
909
I18nNamespaces : []string {"plugin__plugin1" },
908
910
},
909
911
},
912
+ {
913
+ name : "Config builder should set plugins order from available plugins" ,
914
+ input : func () Config {
915
+ b := & ConsoleServerCLIConfigBuilder {}
916
+ b .Plugins (map [string ]string {
917
+ "plugin1" : "plugin1_url" ,
918
+ "plugin2" : "plugin2_url" ,
919
+ }).
920
+ PluginsOrder ([]* consolev1.ConsolePlugin {
921
+ {ObjectMeta : metav1.ObjectMeta {Name : "plugin1" }},
922
+ {ObjectMeta : metav1.ObjectMeta {Name : "plugin2" }},
923
+ }, & v1.Console {
924
+ Spec : v1.ConsoleSpec {
925
+ Plugins : []string {"plugin1" , "plugin2" , "plugin3" },
926
+ },
927
+ })
928
+ return b .Config ()
929
+ },
930
+ output : Config {
931
+ Kind : "ConsoleConfig" ,
932
+ APIVersion : "console.openshift.io/v1" ,
933
+ ServingInfo : ServingInfo {
934
+ BindAddress : "https://[::]:8443" ,
935
+ CertFile : certFilePath ,
936
+ KeyFile : keyFilePath ,
937
+ },
938
+ ClusterInfo : ClusterInfo {
939
+ ConsoleBasePath : "" ,
940
+ },
941
+ Auth : Auth {
942
+ ClientID : api .OpenShiftConsoleName ,
943
+ ClientSecretFile : clientSecretFilePath ,
944
+ },
945
+ Session : Session {},
946
+ Customization : Customization {
947
+ Perspectives : []Perspective {
948
+ {
949
+ ID : "dev" ,
950
+ Visibility : PerspectiveVisibility {State : PerspectiveDisabled },
951
+ },
952
+ },
953
+ },
954
+ Providers : Providers {},
955
+ Plugins : map [string ]string {
956
+ "plugin1" : "plugin1_url" ,
957
+ "plugin2" : "plugin2_url" ,
958
+ },
959
+ PluginsOrder : []string {"plugin1" , "plugin2" },
960
+ },
961
+ },
910
962
{
911
963
name : "Config builder should pass telemetry configuration" ,
912
964
input : func () Config {
0 commit comments