github.com/jlmeeker/kismatic@v1.10.1-0.20180612190640-57f9005a1f1a/pkg/cli/fakes_test.go (about)

     1  package cli
     2  
     3  import (
     4  	"github.com/apprenda/kismatic/pkg/install"
     5  	"github.com/apprenda/kismatic/pkg/tls"
     6  )
     7  
     8  type fakePlanner struct {
     9  	exists            bool
    10  	plan              *install.Plan
    11  	readWriteErr      error
    12  	readCalled        bool
    13  	clusterAddress    string
    14  	clusterAddressErr error
    15  	dashboardURL      string
    16  	dashboardURLErr   error
    17  }
    18  
    19  func (fp *fakePlanner) PlanExists() bool { return fp.exists }
    20  func (fp *fakePlanner) Read() (*install.Plan, error) {
    21  	fp.readCalled = true
    22  	return fp.plan, fp.readWriteErr
    23  }
    24  func (fp *fakePlanner) Write(p *install.Plan) error {
    25  	fp.plan = p
    26  	return fp.readWriteErr
    27  }
    28  
    29  type fakeExecutor struct {
    30  	installCalled bool
    31  	err           error
    32  }
    33  
    34  func (fe *fakeExecutor) AddNode(p *install.Plan, newNode install.Node, roles []string, restartServices bool) (*install.Plan, error) {
    35  	return nil, nil
    36  }
    37  
    38  func (fe *fakeExecutor) GenerateCertificates(*install.Plan, bool) error {
    39  	return nil
    40  }
    41  
    42  func (fe *fakeExecutor) Install(p *install.Plan, restartServices bool, nodes ...string) error {
    43  	fe.installCalled = true
    44  	return fe.err
    45  }
    46  
    47  func (fe *fakeExecutor) Reset(p *install.Plan, nodes ...string) error {
    48  	return nil
    49  }
    50  
    51  func (fe *fakeExecutor) RunPreFlightCheck(p *install.Plan, nodes ...string) error {
    52  	return nil
    53  }
    54  
    55  func (fe *fakeExecutor) RunNewNodePreFlightCheck(install.Plan, install.Node) error {
    56  	return nil
    57  }
    58  
    59  func (fe *fakeExecutor) RunUpgradePreFlightCheck(*install.Plan, install.ListableNode) error {
    60  	return nil
    61  }
    62  
    63  func (fe *fakeExecutor) UpgradeNodes(install.Plan, []install.ListableNode, bool, int, bool) error {
    64  	return nil
    65  }
    66  
    67  func (fe *fakeExecutor) ValidateControlPlane(install.Plan) error {
    68  	return nil
    69  }
    70  
    71  func (fe *fakeExecutor) UpgradeDockerRegistry(install.Plan) error {
    72  	return nil
    73  }
    74  
    75  func (fe *fakeExecutor) UpgradeClusterServices(install.Plan) error {
    76  	return nil
    77  }
    78  
    79  func (fe *fakeExecutor) RunSmokeTest(p *install.Plan) error {
    80  	return nil
    81  }
    82  
    83  func (fe *fakeExecutor) RunPlay(string, *install.Plan, bool, ...string) error {
    84  	return nil
    85  }
    86  
    87  func (fe *fakeExecutor) AddVolume(*install.Plan, install.StorageVolume) error {
    88  	return nil
    89  }
    90  
    91  func (fe *fakeExecutor) DeleteVolume(*install.Plan, string) error {
    92  	return nil
    93  }
    94  
    95  type fakePKI struct {
    96  	called              bool
    97  	generateCACalled    bool
    98  	readClusterCACalled bool
    99  	err                 error
   100  }
   101  
   102  func (fp *fakePKI) ReadClusterCA(p *install.Plan) (*tls.CA, error) {
   103  	fp.readClusterCACalled = true
   104  	return nil, fp.err
   105  }
   106  func (fp *fakePKI) GenerateClusterCA(p *install.Plan) (*tls.CA, error) {
   107  	fp.generateCACalled = true
   108  	return nil, fp.err
   109  }
   110  
   111  func (fp *fakePKI) GenerateClusterCerts(p *install.Plan, ca *tls.CA, users []string) error {
   112  	fp.called = true
   113  	return fp.err
   114  }
   115  
   116  func (fp *fakePKI) GenerateCertificate(name string, validityPeriod string, commonName string, subjectAlternateNames []string, organizations []string, ca *tls.CA, overwrite bool) (bool, error) {
   117  	fp.called = true
   118  	return false, fp.err
   119  }