2022-03-22 16:03:15 +01:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-04-13 15:01:02 +02:00
|
|
|
"errors"
|
2022-03-22 16:03:15 +01:00
|
|
|
|
|
|
|
"github.com/edgelesssys/constellation/coordinator/state"
|
2022-06-01 15:08:42 +02:00
|
|
|
"github.com/edgelesssys/constellation/internal/atls"
|
2022-03-22 16:03:15 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type stubStatusWaiter struct {
|
2022-04-13 15:01:02 +02:00
|
|
|
initialized bool
|
2022-04-27 08:30:47 +02:00
|
|
|
initializeErr error
|
2022-03-22 16:03:15 +01:00
|
|
|
waitForAllErr error
|
|
|
|
}
|
|
|
|
|
2022-04-27 08:30:47 +02:00
|
|
|
func (s *stubStatusWaiter) InitializeValidators([]atls.Validator) error {
|
2022-04-13 15:01:02 +02:00
|
|
|
s.initialized = true
|
2022-04-27 08:30:47 +02:00
|
|
|
return s.initializeErr
|
2022-04-13 15:01:02 +02: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 16:03:15 +01:00
|
|
|
}
|