@@ -471,6 +471,76 @@ var _ = Describe("Provider Cluster Inventory API", Ordered, func() {
471471 shutDownClusters ()
472472 })
473473 })
474+
475+ Context ("Custom readiness check" , Ordered , func () {
476+ const consumerName = "hub"
477+ var sa1TokenMember string
478+
479+ BeforeAll (func () {
480+ ctx , cancel = context .WithCancel (context .Background ())
481+ g , _ = errgroup .WithContext (ctx )
482+
483+ createClusters ()
484+
485+ By ("Setting up the Provider" , func () {
486+ var err error
487+ provider , err = New (Options {
488+ KubeconfigStrategyOption : kubeconfigstrategy.Option {
489+ Secret : & kubeconfigstrategy.SecretStrategyOption {
490+ ConsumerName : consumerName ,
491+ },
492+ },
493+ IsReady : func (ctx context.Context , clp * clusterinventoryv1alpha1.ClusterProfile ) bool {
494+ return true
495+ },
496+ })
497+ Expect (err ).NotTo (HaveOccurred ())
498+ Expect (provider ).NotTo (BeNil ())
499+ })
500+
501+ setupAndStartControllers ()
502+
503+ By ("Setting up the ClusterProfile for member clusters" , func () {
504+ profileMember = & clusterinventoryv1alpha1.ClusterProfile {
505+ ObjectMeta : metav1.ObjectMeta {
506+ Name : "member" ,
507+ Namespace : "default" ,
508+ },
509+ Spec : clusterinventoryv1alpha1.ClusterProfileSpec {
510+ DisplayName : "member" ,
511+ ClusterManager : clusterinventoryv1alpha1.ClusterManager {
512+ Name : "test" ,
513+ },
514+ },
515+ }
516+ Expect (cliHub .Create (ctx , profileMember )).To (Succeed ())
517+
518+ sa1TokenMember = mustCreateAdminSAAndToken (ctx , cliMember , "sa1" , "default" )
519+ mustCreateOrUpdateKubeConfigSecretFromTokenSecret (
520+ ctx , cliHub , cfgMember ,
521+ consumerName ,
522+ * profileMember ,
523+ sa1TokenMember ,
524+ )
525+ })
526+
527+ createObjects ()
528+ })
529+
530+ assertBasicControllerBehavior ()
531+ assertClusterIndexBehavior ()
532+
533+ AfterAll (func () {
534+ By ("Stopping the provider, cluster, manager, and controller" , func () {
535+ cancel ()
536+ })
537+ By ("Waiting for the error group to finish" , func () {
538+ err := g .Wait ()
539+ Expect (err ).NotTo (HaveOccurred ())
540+ })
541+ shutDownClusters ()
542+ })
543+ })
474544})
475545
476546func ignoreCanceled (err error ) error {
0 commit comments