mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-03 23:04:53 -04:00
constellation-lib: refactor init RPC to be shared (#2665)
* constellation-lib: refactor init RPC Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: pass io.Writer for collecting logs Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: add init test Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: bin dialer to struct Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: set service CIDR on init Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> --------- Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com>
This commit is contained in:
parent
db49093da7
commit
17aecaaf5f
12 changed files with 758 additions and 342 deletions
|
@ -11,15 +11,19 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/edgelesssys/constellation/v2/bootstrapper/initproto"
|
||||
"github.com/edgelesssys/constellation/v2/internal/atls"
|
||||
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
||||
"github.com/edgelesssys/constellation/v2/internal/cloud/gcpshared"
|
||||
"github.com/edgelesssys/constellation/v2/internal/config"
|
||||
"github.com/edgelesssys/constellation/v2/internal/constants"
|
||||
"github.com/edgelesssys/constellation/v2/internal/constellation"
|
||||
"github.com/edgelesssys/constellation/v2/internal/file"
|
||||
"github.com/edgelesssys/constellation/v2/internal/helm"
|
||||
"github.com/edgelesssys/constellation/v2/internal/kms/uri"
|
||||
|
@ -488,8 +492,25 @@ func newPhases(phases ...skipPhase) skipPhases {
|
|||
return skipPhases
|
||||
}
|
||||
|
||||
type stubConstellApplier struct{}
|
||||
type stubConstellApplier struct {
|
||||
checkLicenseErr error
|
||||
generateMasterSecretErr error
|
||||
generateMeasurementSaltErr error
|
||||
initErr error
|
||||
}
|
||||
|
||||
func (s *stubConstellApplier) CheckLicense(context.Context, cloudprovider.Provider, string) (int, error) {
|
||||
return 0, nil
|
||||
return 0, s.checkLicenseErr
|
||||
}
|
||||
|
||||
func (s *stubConstellApplier) GenerateMasterSecret() (uri.MasterSecret, error) {
|
||||
return uri.MasterSecret{}, s.generateMasterSecretErr
|
||||
}
|
||||
|
||||
func (s *stubConstellApplier) GenerateMeasurementSalt() ([]byte, error) {
|
||||
return nil, s.generateMeasurementSaltErr
|
||||
}
|
||||
|
||||
func (s *stubConstellApplier) Init(context.Context, atls.Validator, *state.State, io.Writer, constellation.InitPayload) (*initproto.InitSuccessResponse, error) {
|
||||
return nil, s.initErr
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue