53
53
import com .hedera .node .app .spi .fixtures .util .LoggingTarget ;
54
54
import com .hedera .node .app .spi .store .StoreFactory ;
55
55
import com .hedera .node .app .spi .workflows .HandleContext ;
56
- import com .hedera .node .app .spi .workflows .SystemContext ;
57
56
import com .hedera .node .app .spi .workflows .record .StreamBuilder ;
58
57
import com .hedera .node .app .workflows .handle .Dispatch ;
59
58
import com .hedera .node .app .workflows .handle .record .SystemSetup ;
@@ -169,37 +168,29 @@ void successfulAutoUpdatesAreDispatchedWithFilesAvailable() throws IOException {
169
168
given (dispatch .config ()).willReturn (config );
170
169
given (dispatch .consensusNow ()).willReturn (CONSENSUS_NOW );
171
170
given (dispatch .handleContext ()).willReturn (handleContext );
172
- given (handleContext .storeFactory ()).willReturn (storeFactory );
173
- given (storeFactory .readableStore (ReadableNodeStore .class )).willReturn (readableNodeStore );
174
171
given (handleContext .dispatchPrecedingTransaction (any (), any (), any (), any ()))
175
172
.willReturn (streamBuilder );
176
173
177
174
subject .doPostUpgradeSetup (dispatch );
178
175
179
176
final var filesConfig = config .getConfigData (FilesConfig .class );
180
- verify (fileService ).updateNodeDetailsAfterFreeze (any (SystemContext .class ), eq (readableNodeStore ));
181
177
verifyUpdateDispatch (filesConfig .networkProperties (), serializedPropertyOverrides ());
182
178
verifyUpdateDispatch (filesConfig .hapiPermissions (), serializedPermissionOverrides ());
183
179
verifyUpdateDispatch (filesConfig .throttleDefinitions (), serializedThrottleOverrides ());
184
180
verifyUpdateDispatch (filesConfig .feeSchedules (), serializedFeeSchedules ());
185
- verify (stack , times (5 )).commitFullStack ();
181
+ verify (stack , times (4 )).commitFullStack ();
186
182
}
187
183
188
184
@ Test
189
185
void onlyNodeDetailsAutoUpdateIsDispatchedWithNoFilesAvailable () {
190
186
final var config = HederaTestConfigBuilder .create ()
191
187
.withValue ("networkAdmin.upgradeSysFilesLoc" , tempDir .toString ())
192
188
.getOrCreateConfig ();
193
- given (dispatch .stack ()).willReturn (stack );
194
189
given (dispatch .config ()).willReturn (config );
195
- given (dispatch .handleContext ()).willReturn (handleContext );
196
- given (handleContext .storeFactory ()).willReturn (storeFactory );
197
- given (storeFactory .readableStore (ReadableNodeStore .class )).willReturn (readableNodeStore );
198
190
199
191
subject .doPostUpgradeSetup (dispatch );
200
192
201
- verify (fileService ).updateNodeDetailsAfterFreeze (any (SystemContext .class ), eq (readableNodeStore ));
202
- verify (stack , times (1 )).commitFullStack ();
193
+ verify (stack , times (0 )).commitFullStack ();
203
194
204
195
final var infoLogs = logCaptor .infoLogs ();
205
196
assertThat (infoLogs .size ()).isEqualTo (4 );
@@ -209,36 +200,6 @@ void onlyNodeDetailsAutoUpdateIsDispatchedWithNoFilesAvailable() {
209
200
assertThat (infoLogs .getLast ()).startsWith ("No post-upgrade file for api-permission-override.properties" );
210
201
}
211
202
212
- @ Test
213
- void onlyNodeDetailsAutoUpdateIsDispatchedWithInvalidFilesAvailable () throws IOException {
214
- final var config = HederaTestConfigBuilder .create ()
215
- .withValue ("networkAdmin.upgradeSysFilesLoc" , tempDir .toString ())
216
- .getOrCreateConfig ();
217
- final var adminConfig = config .getConfigData (NetworkAdminConfig .class );
218
- Files .writeString (tempDir .resolve (adminConfig .upgradePropertyOverridesFile ()), invalidPropertyOverrides ());
219
- Files .writeString (tempDir .resolve (adminConfig .upgradePermissionOverridesFile ()), invalidPermissionOverrides ());
220
- Files .writeString (tempDir .resolve (adminConfig .upgradeThrottlesFile ()), invalidThrottleOverrides ());
221
- Files .writeString (tempDir .resolve (adminConfig .upgradeFeeSchedulesFile ()), invalidFeeScheduleOverrides ());
222
- given (dispatch .stack ()).willReturn (stack );
223
- given (dispatch .config ()).willReturn (config );
224
- given (dispatch .handleContext ()).willReturn (handleContext );
225
- given (handleContext .storeFactory ()).willReturn (storeFactory );
226
- given (storeFactory .readableStore (ReadableNodeStore .class )).willReturn (readableNodeStore );
227
-
228
- subject .doPostUpgradeSetup (dispatch );
229
-
230
- verify (fileService ).updateNodeDetailsAfterFreeze (any (SystemContext .class ), eq (readableNodeStore ));
231
- verify (stack , times (1 )).commitFullStack ();
232
-
233
- final var errorLogs = logCaptor .errorLogs ();
234
- assertThat (errorLogs .size ()).isEqualTo (4 );
235
- assertThat (errorLogs .getFirst ()).startsWith ("Failed to parse upgrade file for feeSchedules.json" );
236
- assertThat (errorLogs .get (1 )).startsWith ("Failed to parse upgrade file for throttles.json" );
237
- assertThat (errorLogs .get (2 )).startsWith ("Failed to parse upgrade file for application-override.properties" );
238
- assertThat (errorLogs .getLast ())
239
- .startsWith ("Failed to parse upgrade file for api-permission-override.properties" );
240
- }
241
-
242
203
@ Test
243
204
@ SuppressWarnings ("unchecked" )
244
205
void externalizeInitSideEffectsCreatesAllRecords () {
0 commit comments