2022-03-22 11:03:15 -04:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-04-13 09:01:02 -04:00
|
|
|
"errors"
|
2022-03-22 11:03:15 -04:00
|
|
|
|
|
|
|
"github.com/edgelesssys/constellation/coordinator/state"
|
2022-06-01 09:08:42 -04:00
|
|
|
"github.com/edgelesssys/constellation/internal/atls"
|
2022-03-22 11:03:15 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type stubStatusWaiter struct {
|
2022-04-13 09:01:02 -04:00
|
|
|
initialized bool
|
2022-04-27 02:30:47 -04:00
|
|
|
initializeErr error
|
2022-03-22 11:03:15 -04:00
|
|
|
waitForAllErr error
|
|
|
|
}
|
|
|
|
|
2022-04-27 02:30:47 -04:00
|
|
|
func (s *stubStatusWaiter) InitializeValidators([]atls.Validator) error {
|
2022-04-13 09:01:02 -04:00
|
|
|
s.initialized = true
|
2022-04-27 02:30:47 -04:00
|
|
|
return s.initializeErr
|
2022-04-13 09:01:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *stubStatusWaiter) WaitForAll(ctx context.Context, endpoints []string, status ...state.State) error {
|
|
|
|
if !s.initialized {
|
|
|
|
return errors.New("waiter not initialized")
|
|
|
|
}
|
|
|
|
return s.waitForAllErr
|
2022-03-22 11:03:15 -04:00
|
|
|
}
|