constellation/cli/internal/cmd/statuswaiter_test.go

28 lines
584 B
Go
Raw Normal View History

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