This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
mock_configuration_provider.go
94 lines (76 loc) · 4.01 KB
/
mock_configuration_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package mocks
import (
"github.com/flyteorg/flyteadmin/pkg/runtime/interfaces"
ifaceMocks "github.com/flyteorg/flyteadmin/pkg/runtime/interfaces/mocks"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
)
type MockConfigurationProvider struct {
applicationConfiguration interfaces.ApplicationConfiguration
queueConfiguration interfaces.QueueConfiguration
clusterConfiguration interfaces.ClusterConfiguration
taskResourceConfiguration interfaces.TaskResourceConfiguration
whitelistConfiguration interfaces.WhitelistConfiguration
registrationValidationConfiguration interfaces.RegistrationValidationConfiguration
clusterResourceConfiguration interfaces.ClusterResourceConfiguration
namespaceMappingConfiguration interfaces.NamespaceMappingConfiguration
qualityOfServiceConfiguration interfaces.QualityOfServiceConfiguration
}
func (p *MockConfigurationProvider) ApplicationConfiguration() interfaces.ApplicationConfiguration {
return p.applicationConfiguration
}
func (p *MockConfigurationProvider) QueueConfiguration() interfaces.QueueConfiguration {
return p.queueConfiguration
}
func (p *MockConfigurationProvider) ClusterConfiguration() interfaces.ClusterConfiguration {
return p.clusterConfiguration
}
func (p *MockConfigurationProvider) TaskResourceConfiguration() interfaces.TaskResourceConfiguration {
return p.taskResourceConfiguration
}
func (p *MockConfigurationProvider) WhitelistConfiguration() interfaces.WhitelistConfiguration {
return p.whitelistConfiguration
}
func (p *MockConfigurationProvider) RegistrationValidationConfiguration() interfaces.RegistrationValidationConfiguration {
return p.registrationValidationConfiguration
}
func (p *MockConfigurationProvider) AddRegistrationValidationConfiguration(config interfaces.RegistrationValidationConfiguration) {
p.registrationValidationConfiguration = config
}
func (p *MockConfigurationProvider) ClusterResourceConfiguration() interfaces.ClusterResourceConfiguration {
return p.clusterResourceConfiguration
}
func (p *MockConfigurationProvider) AddClusterResourceConfiguration(config interfaces.ClusterResourceConfiguration) {
p.clusterResourceConfiguration = config
}
func (p *MockConfigurationProvider) NamespaceMappingConfiguration() interfaces.NamespaceMappingConfiguration {
return p.namespaceMappingConfiguration
}
func (p *MockConfigurationProvider) AddNamespaceMappingConfiguration(config interfaces.NamespaceMappingConfiguration) {
p.namespaceMappingConfiguration = config
}
func (p *MockConfigurationProvider) QualityOfServiceConfiguration() interfaces.QualityOfServiceConfiguration {
return p.qualityOfServiceConfiguration
}
func (p *MockConfigurationProvider) AddQualityOfServiceConfiguration(config interfaces.QualityOfServiceConfiguration) {
p.qualityOfServiceConfiguration = config
}
func NewMockConfigurationProvider(
applicationConfiguration interfaces.ApplicationConfiguration,
queueConfiguration interfaces.QueueConfiguration,
clusterConfiguration interfaces.ClusterConfiguration,
taskResourceConfiguration interfaces.TaskResourceConfiguration,
whitelistConfiguration interfaces.WhitelistConfiguration,
namespaceMappingConfiguration interfaces.NamespaceMappingConfiguration) interfaces.Configuration {
mockQualityOfServiceConfiguration := &ifaceMocks.QualityOfServiceConfiguration{}
mockQualityOfServiceConfiguration.OnGetDefaultTiers().Return(make(map[string]core.QualityOfService_Tier))
mockQualityOfServiceConfiguration.OnGetTierExecutionValues().Return(make(map[core.QualityOfService_Tier]core.QualityOfServiceSpec))
return &MockConfigurationProvider{
applicationConfiguration: applicationConfiguration,
queueConfiguration: queueConfiguration,
clusterConfiguration: clusterConfiguration,
taskResourceConfiguration: taskResourceConfiguration,
whitelistConfiguration: whitelistConfiguration,
namespaceMappingConfiguration: namespaceMappingConfiguration,
qualityOfServiceConfiguration: mockQualityOfServiceConfiguration,
}
}