github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/worker/uniter/container/utils_test.go (about)

     1  // Copyright 2021 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package container_test
     5  
     6  import (
     7  	"github.com/juju/juju/worker/uniter/hook"
     8  	"github.com/juju/juju/worker/uniter/operation"
     9  	"github.com/juju/juju/worker/uniter/remotestate"
    10  )
    11  
    12  type mockOperations struct {
    13  	operation.Factory
    14  }
    15  
    16  func (m *mockOperations) NewRemoteInit(runningStatus remotestate.ContainerRunningStatus) (operation.Operation, error) {
    17  	return &mockRemoteInit{runningStatus: runningStatus}, nil
    18  }
    19  
    20  func (m *mockOperations) NewSkipRemoteInit(retry bool) (operation.Operation, error) {
    21  	return &mockSkipOp{retry: retry}, nil
    22  }
    23  
    24  func (m *mockOperations) NewRunHook(hookInfo hook.Info) (operation.Operation, error) {
    25  	return &mockRunHookOp{hookInfo: hookInfo}, nil
    26  }
    27  
    28  func (m *mockOperations) NewSkipHook(hookInfo hook.Info) (operation.Operation, error) {
    29  	return &mockSkipHookOp{hookInfo: hookInfo}, nil
    30  }
    31  
    32  type mockRemoteInit struct {
    33  	operation.Operation
    34  	runningStatus remotestate.ContainerRunningStatus
    35  }
    36  
    37  func (op *mockRemoteInit) String() string {
    38  	return "remote init"
    39  }
    40  
    41  type mockSkipOp struct {
    42  	operation.Operation
    43  	retry bool
    44  }
    45  
    46  func (op *mockSkipOp) String() string {
    47  	return "skip remote init"
    48  }
    49  
    50  type mockRunHookOp struct {
    51  	operation.Operation
    52  	hookInfo hook.Info
    53  }
    54  
    55  func (op *mockRunHookOp) String() string {
    56  	return "hook op"
    57  }
    58  
    59  type mockSkipHookOp struct {
    60  	operation.Operation
    61  	hookInfo hook.Info
    62  }
    63  
    64  func (op *mockSkipHookOp) String() string {
    65  	return "skip hook op"
    66  }