qontract-reconcile 0.10.1rc764__py3-none-any.whl → 0.10.1rc765__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qontract_reconcile-0.10.1rc764.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.1rc764.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/RECORD +16 -31
- reconcile/saas_auto_promotions_manager/meta.py +1 -1
- reconcile/saas_auto_promotions_manager/subscriber.py +52 -2
- reconcile/saas_auto_promotions_manager/utils/saas_files_inventory.py +4 -0
- reconcile/test/saas_auto_promotions_manager/conftest.py +63 -0
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/conftest.py +0 -37
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_desired_state.py +20 -14
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/conftest.py +0 -43
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_multiple_namespaces.py +4 -11
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_namespace.py +12 -19
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_target.py +6 -12
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_json_path_selector.py +8 -15
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/data_keys.py +0 -4
- reconcile/test/saas_auto_promotions_manager/subscriber/__init__.py +0 -0
- reconcile/test/saas_auto_promotions_manager/subscriber/conftest.py +0 -89
- reconcile/test/saas_auto_promotions_manager/subscriber/data_keys.py +0 -11
- reconcile/test/saas_auto_promotions_manager/subscriber/test_content_hash.py +0 -130
- reconcile/test/saas_auto_promotions_manager/subscriber/test_diff.py +0 -161
- reconcile/test/saas_auto_promotions_manager/subscriber/test_multiple_channels_config_hash.py +0 -218
- reconcile/test/saas_auto_promotions_manager/subscriber/test_multiple_channels_moving_ref.py +0 -216
- reconcile/test/saas_auto_promotions_manager/subscriber/test_multiple_publishers_moving_ref.py +0 -129
- reconcile/test/saas_auto_promotions_manager/subscriber/test_single_channel_with_single_publisher.py +0 -330
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/__init__.py +0 -0
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_multiple_publishers_for_single_channel.py +0 -68
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_use_target_config_hash.py +0 -62
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_with_auto_promote.py +0 -73
- reconcile/test/saas_auto_promotions_manager/utils/saas_files_inventory/test_saas_files_without_auto_promote.py +0 -64
- {qontract_reconcile-0.10.1rc764.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.1rc764.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/entry_points.txt +0 -0
- {qontract_reconcile-0.10.1rc764.dist-info → qontract_reconcile-0.10.1rc765.dist-info}/top_level.txt +0 -0
@@ -1,216 +0,0 @@
|
|
1
|
-
from collections.abc import (
|
2
|
-
Callable,
|
3
|
-
Mapping,
|
4
|
-
)
|
5
|
-
from typing import Any
|
6
|
-
|
7
|
-
from reconcile.saas_auto_promotions_manager.subscriber import (
|
8
|
-
ConfigHash,
|
9
|
-
Subscriber,
|
10
|
-
)
|
11
|
-
|
12
|
-
from .data_keys import (
|
13
|
-
CHANNELS,
|
14
|
-
CONFIG_HASH,
|
15
|
-
CUR_CONFIG_HASHES,
|
16
|
-
CUR_SUBSCRIBER_REF,
|
17
|
-
REAL_WORLD_SHA,
|
18
|
-
SUCCESSFUL_DEPLOYMENT,
|
19
|
-
)
|
20
|
-
|
21
|
-
|
22
|
-
def test_no_change(
|
23
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
24
|
-
):
|
25
|
-
subscriber = subscriber_builder({
|
26
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
27
|
-
CUR_CONFIG_HASHES: [
|
28
|
-
ConfigHash(
|
29
|
-
channel="channel-a",
|
30
|
-
parent_saas="publisher_a",
|
31
|
-
target_config_hash="pub_a_hash",
|
32
|
-
),
|
33
|
-
ConfigHash(
|
34
|
-
channel="channel-b",
|
35
|
-
parent_saas="publisher_b",
|
36
|
-
target_config_hash="pub_b_hash",
|
37
|
-
),
|
38
|
-
],
|
39
|
-
CHANNELS: {
|
40
|
-
"channel-a": {
|
41
|
-
"publisher_a": {
|
42
|
-
REAL_WORLD_SHA: "current_sha",
|
43
|
-
CONFIG_HASH: "pub_a_hash",
|
44
|
-
}
|
45
|
-
},
|
46
|
-
"channel-b": {
|
47
|
-
"publisher_b": {
|
48
|
-
REAL_WORLD_SHA: "current_sha",
|
49
|
-
CONFIG_HASH: "pub_b_hash",
|
50
|
-
}
|
51
|
-
},
|
52
|
-
},
|
53
|
-
})
|
54
|
-
subscriber.compute_desired_state()
|
55
|
-
expected_config_hashes = [
|
56
|
-
ConfigHash(
|
57
|
-
channel="channel-a",
|
58
|
-
parent_saas="publisher_a",
|
59
|
-
target_config_hash="pub_a_hash",
|
60
|
-
),
|
61
|
-
ConfigHash(
|
62
|
-
channel="channel-b",
|
63
|
-
parent_saas="publisher_b",
|
64
|
-
target_config_hash="pub_b_hash",
|
65
|
-
),
|
66
|
-
]
|
67
|
-
assert subscriber.desired_ref == "current_sha"
|
68
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
69
|
-
|
70
|
-
|
71
|
-
def test_moving_ref(
|
72
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
73
|
-
):
|
74
|
-
subscriber = subscriber_builder({
|
75
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
76
|
-
CUR_CONFIG_HASHES: [
|
77
|
-
ConfigHash(
|
78
|
-
channel="channel-a",
|
79
|
-
parent_saas="publisher_a",
|
80
|
-
target_config_hash="pub_a_hash",
|
81
|
-
),
|
82
|
-
ConfigHash(
|
83
|
-
channel="channel-b",
|
84
|
-
parent_saas="publisher_b",
|
85
|
-
target_config_hash="pub_b_hash",
|
86
|
-
),
|
87
|
-
],
|
88
|
-
CHANNELS: {
|
89
|
-
"channel-a": {
|
90
|
-
"publisher_a": {
|
91
|
-
REAL_WORLD_SHA: "new_sha",
|
92
|
-
CONFIG_HASH: "pub_a_hash",
|
93
|
-
}
|
94
|
-
},
|
95
|
-
"channel-b": {
|
96
|
-
"publisher_b": {
|
97
|
-
REAL_WORLD_SHA: "new_sha",
|
98
|
-
CONFIG_HASH: "pub_b_hash",
|
99
|
-
}
|
100
|
-
},
|
101
|
-
},
|
102
|
-
})
|
103
|
-
subscriber.compute_desired_state()
|
104
|
-
expected_config_hashes = [
|
105
|
-
ConfigHash(
|
106
|
-
channel="channel-a",
|
107
|
-
parent_saas="publisher_a",
|
108
|
-
target_config_hash="pub_a_hash",
|
109
|
-
),
|
110
|
-
ConfigHash(
|
111
|
-
channel="channel-b",
|
112
|
-
parent_saas="publisher_b",
|
113
|
-
target_config_hash="pub_b_hash",
|
114
|
-
),
|
115
|
-
]
|
116
|
-
assert subscriber.desired_ref == "new_sha"
|
117
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
118
|
-
|
119
|
-
|
120
|
-
def test_moving_ref_mismatch(
|
121
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
122
|
-
):
|
123
|
-
subscriber = subscriber_builder({
|
124
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
125
|
-
CUR_CONFIG_HASHES: [
|
126
|
-
ConfigHash(
|
127
|
-
channel="channel-a",
|
128
|
-
parent_saas="publisher_a",
|
129
|
-
target_config_hash="pub_a_hash",
|
130
|
-
),
|
131
|
-
ConfigHash(
|
132
|
-
channel="channel-b",
|
133
|
-
parent_saas="publisher_b",
|
134
|
-
target_config_hash="pub_b_hash",
|
135
|
-
),
|
136
|
-
],
|
137
|
-
CHANNELS: {
|
138
|
-
"channel-a": {
|
139
|
-
"publisher_a": {
|
140
|
-
REAL_WORLD_SHA: "new_sha",
|
141
|
-
CONFIG_HASH: "pub_a_hash",
|
142
|
-
}
|
143
|
-
},
|
144
|
-
"channel-b": {
|
145
|
-
"publisher_b": {
|
146
|
-
REAL_WORLD_SHA: "other_new_sha",
|
147
|
-
CONFIG_HASH: "pub_b_hash",
|
148
|
-
}
|
149
|
-
},
|
150
|
-
},
|
151
|
-
})
|
152
|
-
subscriber.compute_desired_state()
|
153
|
-
expected_config_hashes = [
|
154
|
-
ConfigHash(
|
155
|
-
channel="channel-a",
|
156
|
-
parent_saas="publisher_a",
|
157
|
-
target_config_hash="pub_a_hash",
|
158
|
-
),
|
159
|
-
ConfigHash(
|
160
|
-
channel="channel-b",
|
161
|
-
parent_saas="publisher_b",
|
162
|
-
target_config_hash="pub_b_hash",
|
163
|
-
),
|
164
|
-
]
|
165
|
-
assert subscriber.desired_ref == "current_sha"
|
166
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
167
|
-
|
168
|
-
|
169
|
-
def test_moving_ref_bad_deployment(
|
170
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
171
|
-
):
|
172
|
-
subscriber = subscriber_builder({
|
173
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
174
|
-
CUR_CONFIG_HASHES: [
|
175
|
-
ConfigHash(
|
176
|
-
channel="channel-a",
|
177
|
-
parent_saas="publisher_a",
|
178
|
-
target_config_hash="pub_a_hash",
|
179
|
-
),
|
180
|
-
ConfigHash(
|
181
|
-
channel="channel-b",
|
182
|
-
parent_saas="publisher_b",
|
183
|
-
target_config_hash="pub_b_hash",
|
184
|
-
),
|
185
|
-
],
|
186
|
-
CHANNELS: {
|
187
|
-
"channel-a": {
|
188
|
-
"publisher_a": {
|
189
|
-
REAL_WORLD_SHA: "new_sha",
|
190
|
-
CONFIG_HASH: "pub_a_hash",
|
191
|
-
SUCCESSFUL_DEPLOYMENT: False,
|
192
|
-
}
|
193
|
-
},
|
194
|
-
"channel-b": {
|
195
|
-
"publisher_b": {
|
196
|
-
REAL_WORLD_SHA: "new_sha",
|
197
|
-
CONFIG_HASH: "pub_b_hash",
|
198
|
-
}
|
199
|
-
},
|
200
|
-
},
|
201
|
-
})
|
202
|
-
subscriber.compute_desired_state()
|
203
|
-
expected_config_hashes = [
|
204
|
-
ConfigHash(
|
205
|
-
channel="channel-a",
|
206
|
-
parent_saas="publisher_a",
|
207
|
-
target_config_hash="pub_a_hash",
|
208
|
-
),
|
209
|
-
ConfigHash(
|
210
|
-
channel="channel-b",
|
211
|
-
parent_saas="publisher_b",
|
212
|
-
target_config_hash="pub_b_hash",
|
213
|
-
),
|
214
|
-
]
|
215
|
-
assert subscriber.desired_ref == "current_sha"
|
216
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
reconcile/test/saas_auto_promotions_manager/subscriber/test_multiple_publishers_moving_ref.py
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
from collections.abc import (
|
2
|
-
Callable,
|
3
|
-
Mapping,
|
4
|
-
)
|
5
|
-
from typing import Any
|
6
|
-
|
7
|
-
from reconcile.saas_auto_promotions_manager.subscriber import Subscriber
|
8
|
-
|
9
|
-
from .data_keys import (
|
10
|
-
CHANNELS,
|
11
|
-
CUR_CONFIG_HASHES,
|
12
|
-
CUR_SUBSCRIBER_REF,
|
13
|
-
REAL_WORLD_SHA,
|
14
|
-
SUCCESSFUL_DEPLOYMENT,
|
15
|
-
USE_TARGET_CONFIG_HASH,
|
16
|
-
)
|
17
|
-
|
18
|
-
|
19
|
-
def test_no_change(
|
20
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
21
|
-
):
|
22
|
-
subscriber = subscriber_builder({
|
23
|
-
USE_TARGET_CONFIG_HASH: False,
|
24
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
25
|
-
CUR_CONFIG_HASHES: [],
|
26
|
-
CHANNELS: {
|
27
|
-
"channel-a": {
|
28
|
-
"publisher_a": {
|
29
|
-
REAL_WORLD_SHA: "current_sha",
|
30
|
-
},
|
31
|
-
"publisher_b": {
|
32
|
-
REAL_WORLD_SHA: "current_sha",
|
33
|
-
},
|
34
|
-
},
|
35
|
-
"channel-b": {
|
36
|
-
"publisher_c": {
|
37
|
-
REAL_WORLD_SHA: "current_sha",
|
38
|
-
},
|
39
|
-
},
|
40
|
-
},
|
41
|
-
})
|
42
|
-
subscriber.compute_desired_state()
|
43
|
-
assert subscriber.desired_ref == "current_sha"
|
44
|
-
assert subscriber.desired_hashes == []
|
45
|
-
|
46
|
-
|
47
|
-
def test_moving_ref(
|
48
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
49
|
-
):
|
50
|
-
subscriber = subscriber_builder({
|
51
|
-
USE_TARGET_CONFIG_HASH: False,
|
52
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
53
|
-
CUR_CONFIG_HASHES: [],
|
54
|
-
CHANNELS: {
|
55
|
-
"channel-a": {
|
56
|
-
"publisher_a": {
|
57
|
-
REAL_WORLD_SHA: "new_sha",
|
58
|
-
},
|
59
|
-
"publisher_b": {
|
60
|
-
REAL_WORLD_SHA: "new_sha",
|
61
|
-
},
|
62
|
-
},
|
63
|
-
"channel-b": {
|
64
|
-
"publisher_c": {
|
65
|
-
REAL_WORLD_SHA: "new_sha",
|
66
|
-
}
|
67
|
-
},
|
68
|
-
},
|
69
|
-
})
|
70
|
-
subscriber.compute_desired_state()
|
71
|
-
assert subscriber.desired_ref == "new_sha"
|
72
|
-
assert subscriber.desired_hashes == []
|
73
|
-
|
74
|
-
|
75
|
-
def test_moving_ref_mismatch(
|
76
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
77
|
-
):
|
78
|
-
subscriber = subscriber_builder({
|
79
|
-
USE_TARGET_CONFIG_HASH: False,
|
80
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
81
|
-
CUR_CONFIG_HASHES: [],
|
82
|
-
CHANNELS: {
|
83
|
-
"channel-a": {
|
84
|
-
"publisher_a": {
|
85
|
-
REAL_WORLD_SHA: "new_sha",
|
86
|
-
},
|
87
|
-
"publisher_b": {
|
88
|
-
REAL_WORLD_SHA: "other_new_sha",
|
89
|
-
},
|
90
|
-
},
|
91
|
-
"channel-b": {
|
92
|
-
"publisher_c": {
|
93
|
-
REAL_WORLD_SHA: "new_sha",
|
94
|
-
}
|
95
|
-
},
|
96
|
-
},
|
97
|
-
})
|
98
|
-
subscriber.compute_desired_state()
|
99
|
-
assert subscriber.desired_ref == "current_sha"
|
100
|
-
assert subscriber.desired_hashes == []
|
101
|
-
|
102
|
-
|
103
|
-
def test_moving_ref_bad_deployment(
|
104
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
105
|
-
):
|
106
|
-
subscriber = subscriber_builder({
|
107
|
-
USE_TARGET_CONFIG_HASH: False,
|
108
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
109
|
-
CUR_CONFIG_HASHES: [],
|
110
|
-
CHANNELS: {
|
111
|
-
"channel-a": {
|
112
|
-
"publisher_a": {
|
113
|
-
REAL_WORLD_SHA: "new_sha",
|
114
|
-
},
|
115
|
-
"publisher_b": {
|
116
|
-
REAL_WORLD_SHA: "new_sha",
|
117
|
-
SUCCESSFUL_DEPLOYMENT: False,
|
118
|
-
},
|
119
|
-
},
|
120
|
-
"channel-b": {
|
121
|
-
"publisher_c": {
|
122
|
-
REAL_WORLD_SHA: "new_sha",
|
123
|
-
}
|
124
|
-
},
|
125
|
-
},
|
126
|
-
})
|
127
|
-
subscriber.compute_desired_state()
|
128
|
-
assert subscriber.desired_ref == "current_sha"
|
129
|
-
assert subscriber.desired_hashes == []
|
reconcile/test/saas_auto_promotions_manager/subscriber/test_single_channel_with_single_publisher.py
DELETED
@@ -1,330 +0,0 @@
|
|
1
|
-
from collections.abc import (
|
2
|
-
Callable,
|
3
|
-
Mapping,
|
4
|
-
)
|
5
|
-
from typing import Any
|
6
|
-
|
7
|
-
from reconcile.saas_auto_promotions_manager.subscriber import (
|
8
|
-
ConfigHash,
|
9
|
-
Subscriber,
|
10
|
-
)
|
11
|
-
|
12
|
-
from .data_keys import (
|
13
|
-
CHANNELS,
|
14
|
-
CONFIG_HASH,
|
15
|
-
CUR_CONFIG_HASHES,
|
16
|
-
CUR_SUBSCRIBER_REF,
|
17
|
-
REAL_WORLD_SHA,
|
18
|
-
SUCCESSFUL_DEPLOYMENT,
|
19
|
-
USE_TARGET_CONFIG_HASH,
|
20
|
-
)
|
21
|
-
|
22
|
-
|
23
|
-
def test_no_change(
|
24
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
25
|
-
):
|
26
|
-
subscriber = subscriber_builder({
|
27
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
28
|
-
CUR_CONFIG_HASHES: [
|
29
|
-
ConfigHash(
|
30
|
-
channel="channel-a",
|
31
|
-
parent_saas="publisher_a",
|
32
|
-
target_config_hash="current_hash",
|
33
|
-
),
|
34
|
-
],
|
35
|
-
CHANNELS: {
|
36
|
-
"channel-a": {
|
37
|
-
"publisher_a": {
|
38
|
-
REAL_WORLD_SHA: "current_sha",
|
39
|
-
CONFIG_HASH: "current_hash",
|
40
|
-
}
|
41
|
-
},
|
42
|
-
},
|
43
|
-
})
|
44
|
-
subscriber.compute_desired_state()
|
45
|
-
expected_config_hashes = [
|
46
|
-
ConfigHash(
|
47
|
-
channel="channel-a",
|
48
|
-
parent_saas="publisher_a",
|
49
|
-
target_config_hash="current_hash",
|
50
|
-
)
|
51
|
-
]
|
52
|
-
assert subscriber.desired_ref == "current_sha"
|
53
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
54
|
-
|
55
|
-
|
56
|
-
def test_moving_ref(
|
57
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
58
|
-
):
|
59
|
-
subscriber = subscriber_builder({
|
60
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
61
|
-
CUR_CONFIG_HASHES: [
|
62
|
-
ConfigHash(
|
63
|
-
channel="channel-a",
|
64
|
-
parent_saas="publisher_a",
|
65
|
-
target_config_hash="current_hash",
|
66
|
-
),
|
67
|
-
],
|
68
|
-
CHANNELS: {
|
69
|
-
"channel-a": {
|
70
|
-
"publisher_a": {
|
71
|
-
REAL_WORLD_SHA: "new_sha",
|
72
|
-
CONFIG_HASH: "current_hash",
|
73
|
-
}
|
74
|
-
},
|
75
|
-
},
|
76
|
-
})
|
77
|
-
subscriber.compute_desired_state()
|
78
|
-
expected_config_hashes = [
|
79
|
-
ConfigHash(
|
80
|
-
channel="channel-a",
|
81
|
-
parent_saas="publisher_a",
|
82
|
-
target_config_hash="current_hash",
|
83
|
-
)
|
84
|
-
]
|
85
|
-
assert subscriber.desired_ref == "new_sha"
|
86
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
87
|
-
|
88
|
-
|
89
|
-
def test_moving_ref_bad_deployment(
|
90
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
91
|
-
):
|
92
|
-
subscriber = subscriber_builder({
|
93
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
94
|
-
CUR_CONFIG_HASHES: [
|
95
|
-
ConfigHash(
|
96
|
-
channel="channel-a",
|
97
|
-
parent_saas="publisher_a",
|
98
|
-
target_config_hash="current_hash",
|
99
|
-
),
|
100
|
-
],
|
101
|
-
CHANNELS: {
|
102
|
-
"channel-a": {
|
103
|
-
"publisher_a": {
|
104
|
-
REAL_WORLD_SHA: "new_sha",
|
105
|
-
CONFIG_HASH: "current_hash",
|
106
|
-
SUCCESSFUL_DEPLOYMENT: False,
|
107
|
-
}
|
108
|
-
},
|
109
|
-
},
|
110
|
-
})
|
111
|
-
subscriber.compute_desired_state()
|
112
|
-
expected_config_hashes = [
|
113
|
-
ConfigHash(
|
114
|
-
channel="channel-a",
|
115
|
-
parent_saas="publisher_a",
|
116
|
-
target_config_hash="current_hash",
|
117
|
-
)
|
118
|
-
]
|
119
|
-
assert subscriber.desired_ref == "current_sha"
|
120
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
121
|
-
|
122
|
-
|
123
|
-
def test_new_config_hash(
|
124
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
125
|
-
):
|
126
|
-
subscriber = subscriber_builder({
|
127
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
128
|
-
CUR_CONFIG_HASHES: [
|
129
|
-
ConfigHash(
|
130
|
-
channel="channel-a",
|
131
|
-
parent_saas="publisher_a",
|
132
|
-
target_config_hash="current_hash",
|
133
|
-
),
|
134
|
-
],
|
135
|
-
CHANNELS: {
|
136
|
-
"channel-a": {
|
137
|
-
"publisher_a": {
|
138
|
-
REAL_WORLD_SHA: "current_sha",
|
139
|
-
CONFIG_HASH: "new_hash",
|
140
|
-
}
|
141
|
-
},
|
142
|
-
},
|
143
|
-
})
|
144
|
-
subscriber.compute_desired_state()
|
145
|
-
expected_config_hashes = [
|
146
|
-
ConfigHash(
|
147
|
-
channel="channel-a",
|
148
|
-
parent_saas="publisher_a",
|
149
|
-
target_config_hash="new_hash",
|
150
|
-
)
|
151
|
-
]
|
152
|
-
assert subscriber.desired_ref == "current_sha"
|
153
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
154
|
-
|
155
|
-
|
156
|
-
def test_new_config_hash_bad_deployment(
|
157
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
158
|
-
):
|
159
|
-
subscriber = subscriber_builder({
|
160
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
161
|
-
CUR_CONFIG_HASHES: [
|
162
|
-
ConfigHash(
|
163
|
-
channel="channel-a",
|
164
|
-
parent_saas="publisher_a",
|
165
|
-
target_config_hash="current_hash",
|
166
|
-
),
|
167
|
-
],
|
168
|
-
CHANNELS: {
|
169
|
-
"channel-a": {
|
170
|
-
"publisher_a": {
|
171
|
-
REAL_WORLD_SHA: "current_sha",
|
172
|
-
CONFIG_HASH: "new_hash",
|
173
|
-
SUCCESSFUL_DEPLOYMENT: False,
|
174
|
-
}
|
175
|
-
},
|
176
|
-
},
|
177
|
-
})
|
178
|
-
subscriber.compute_desired_state()
|
179
|
-
expected_config_hashes = [
|
180
|
-
ConfigHash(
|
181
|
-
channel="channel-a",
|
182
|
-
parent_saas="publisher_a",
|
183
|
-
target_config_hash="current_hash",
|
184
|
-
)
|
185
|
-
]
|
186
|
-
assert subscriber.desired_ref == "current_sha"
|
187
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
188
|
-
|
189
|
-
|
190
|
-
def test_new_config_hash_and_moving_ref(
|
191
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
192
|
-
):
|
193
|
-
subscriber = subscriber_builder({
|
194
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
195
|
-
CUR_CONFIG_HASHES: [
|
196
|
-
ConfigHash(
|
197
|
-
channel="channel-a",
|
198
|
-
parent_saas="publisher_a",
|
199
|
-
target_config_hash="current_hash",
|
200
|
-
),
|
201
|
-
],
|
202
|
-
CHANNELS: {
|
203
|
-
"channel-a": {
|
204
|
-
"publisher_a": {
|
205
|
-
REAL_WORLD_SHA: "new_sha",
|
206
|
-
CONFIG_HASH: "new_hash",
|
207
|
-
}
|
208
|
-
},
|
209
|
-
},
|
210
|
-
})
|
211
|
-
subscriber.compute_desired_state()
|
212
|
-
expected_config_hashes = [
|
213
|
-
ConfigHash(
|
214
|
-
channel="channel-a",
|
215
|
-
parent_saas="publisher_a",
|
216
|
-
target_config_hash="new_hash",
|
217
|
-
)
|
218
|
-
]
|
219
|
-
assert subscriber.desired_ref == "new_sha"
|
220
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
221
|
-
|
222
|
-
|
223
|
-
def test_new_config_hash_and_moving_ref_and_bad_deployment(
|
224
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
225
|
-
):
|
226
|
-
subscriber = subscriber_builder({
|
227
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
228
|
-
CUR_CONFIG_HASHES: [
|
229
|
-
ConfigHash(
|
230
|
-
channel="channel-a",
|
231
|
-
parent_saas="publisher_a",
|
232
|
-
target_config_hash="current_hash",
|
233
|
-
),
|
234
|
-
],
|
235
|
-
CHANNELS: {
|
236
|
-
"channel-a": {
|
237
|
-
"publisher_a": {
|
238
|
-
REAL_WORLD_SHA: "new_sha",
|
239
|
-
CONFIG_HASH: "new_hash",
|
240
|
-
SUCCESSFUL_DEPLOYMENT: False,
|
241
|
-
}
|
242
|
-
},
|
243
|
-
},
|
244
|
-
})
|
245
|
-
subscriber.compute_desired_state()
|
246
|
-
expected_config_hashes = [
|
247
|
-
ConfigHash(
|
248
|
-
channel="channel-a",
|
249
|
-
parent_saas="publisher_a",
|
250
|
-
target_config_hash="current_hash",
|
251
|
-
)
|
252
|
-
]
|
253
|
-
assert subscriber.desired_ref == "current_sha"
|
254
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
255
|
-
|
256
|
-
|
257
|
-
def test_cur_config_hash_did_not_exist(
|
258
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
259
|
-
):
|
260
|
-
subscriber = subscriber_builder({
|
261
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
262
|
-
CUR_CONFIG_HASHES: [],
|
263
|
-
CHANNELS: {
|
264
|
-
"channel-a": {
|
265
|
-
"publisher_a": {
|
266
|
-
REAL_WORLD_SHA: "current_sha",
|
267
|
-
CONFIG_HASH: "new_hash",
|
268
|
-
}
|
269
|
-
},
|
270
|
-
},
|
271
|
-
})
|
272
|
-
subscriber.compute_desired_state()
|
273
|
-
expected_config_hashes = [
|
274
|
-
ConfigHash(
|
275
|
-
channel="channel-a",
|
276
|
-
parent_saas="publisher_a",
|
277
|
-
target_config_hash="new_hash",
|
278
|
-
)
|
279
|
-
]
|
280
|
-
assert subscriber.desired_ref == "current_sha"
|
281
|
-
assert subscriber.desired_hashes == expected_config_hashes
|
282
|
-
|
283
|
-
|
284
|
-
def test_cur_config_hash_did_not_exist_and_neglect(
|
285
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
286
|
-
):
|
287
|
-
subscriber = subscriber_builder({
|
288
|
-
USE_TARGET_CONFIG_HASH: False,
|
289
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
290
|
-
CUR_CONFIG_HASHES: [],
|
291
|
-
CHANNELS: {
|
292
|
-
"channel-a": {
|
293
|
-
"publisher_a": {
|
294
|
-
REAL_WORLD_SHA: "current_sha",
|
295
|
-
CONFIG_HASH: "new_hash",
|
296
|
-
}
|
297
|
-
},
|
298
|
-
},
|
299
|
-
})
|
300
|
-
subscriber.compute_desired_state()
|
301
|
-
assert subscriber.desired_ref == "current_sha"
|
302
|
-
assert subscriber.desired_hashes == []
|
303
|
-
|
304
|
-
|
305
|
-
def test_neglect_config_hashes(
|
306
|
-
subscriber_builder: Callable[[Mapping[str, Any]], Subscriber],
|
307
|
-
):
|
308
|
-
subscriber = subscriber_builder({
|
309
|
-
USE_TARGET_CONFIG_HASH: False,
|
310
|
-
CUR_SUBSCRIBER_REF: "current_sha",
|
311
|
-
CUR_CONFIG_HASHES: [
|
312
|
-
ConfigHash(
|
313
|
-
channel="channel-a",
|
314
|
-
parent_saas="publisher_a",
|
315
|
-
target_config_hash="old_hash",
|
316
|
-
),
|
317
|
-
],
|
318
|
-
CHANNELS: {
|
319
|
-
"channel-a": {
|
320
|
-
"publisher_a": {
|
321
|
-
REAL_WORLD_SHA: "current_sha",
|
322
|
-
CONFIG_HASH: "new_hash",
|
323
|
-
}
|
324
|
-
},
|
325
|
-
},
|
326
|
-
})
|
327
|
-
subscriber.compute_desired_state()
|
328
|
-
|
329
|
-
assert subscriber.desired_ref == "current_sha"
|
330
|
-
assert subscriber.desired_hashes == []
|
File without changes
|