From 51c62347bfa64e0ea002514a3815f507baf1dbb8 Mon Sep 17 00:00:00 2001 From: bokoto000 Date: Mon, 27 Nov 2023 10:13:59 +0200 Subject: [PATCH] Fix tests (#249) --- src/main/java/com/limechain/runtime/RuntimeBuilder.java | 2 +- .../runtime/hostapi/ChildStorageHostFunctions.java | 8 ++++---- .../com/limechain/network/protocol/sync/SyncTest.java | 2 -- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/limechain/runtime/RuntimeBuilder.java b/src/main/java/com/limechain/runtime/RuntimeBuilder.java index b49a07b79..54d7425e5 100644 --- a/src/main/java/com/limechain/runtime/RuntimeBuilder.java +++ b/src/main/java/com/limechain/runtime/RuntimeBuilder.java @@ -68,7 +68,7 @@ static Imports getImports(Module module, HostApi hostApi) { ArrayList objects = new ArrayList<>(); objects.addAll(StorageHostFunctions.getFunctions(hostApi)); - objects.addAll(ChildStorageHostFunctions.getFunctions()); + objects.addAll(ChildStorageHostFunctions.getFunctions(hostApi)); objects.addAll(CryptoHostFunctions.getFunctions(hostApi)); objects.addAll(HashingHostFunctions.getFunctions(hostApi)); objects.addAll(OffchainHostFunctions.getFunctions(hostApi)); diff --git a/src/main/java/com/limechain/runtime/hostapi/ChildStorageHostFunctions.java b/src/main/java/com/limechain/runtime/hostapi/ChildStorageHostFunctions.java index 1217248c1..065bb1fb3 100644 --- a/src/main/java/com/limechain/runtime/hostapi/ChildStorageHostFunctions.java +++ b/src/main/java/com/limechain/runtime/hostapi/ChildStorageHostFunctions.java @@ -26,13 +26,13 @@ public class ChildStorageHostFunctions { private final HostApi hostApi; private final KVRepository repository; - public ChildStorageHostFunctions() { - this.hostApi = HostApi.getInstance(); + public ChildStorageHostFunctions(HostApi hostApi) { + this.hostApi = hostApi; this.repository = SyncedState.getInstance().getRepository(); } - public static List getFunctions() { - return new ChildStorageHostFunctions().buildFunctions(); + public static List getFunctions(HostApi hostApi) { + return new ChildStorageHostFunctions(hostApi).buildFunctions(); } public List buildFunctions() { diff --git a/src/test/java/com/limechain/network/protocol/sync/SyncTest.java b/src/test/java/com/limechain/network/protocol/sync/SyncTest.java index 3a6c3f7da..c6733a9f3 100644 --- a/src/test/java/com/limechain/network/protocol/sync/SyncTest.java +++ b/src/test/java/com/limechain/network/protocol/sync/SyncTest.java @@ -55,7 +55,6 @@ public void stopNode() { } } - @Disabled("This is integration test!") @Test @Disabled("No response is received") //TODO: See https://github.com/orgs/LimeChain/projects/16?pane=issue&itemId=40022251 @@ -78,7 +77,6 @@ void remoteBlockRequest_returnCorrectBlock_ifGivenBlockHash() { assertEquals(expected, response.getBlocks(0).getHash()); } - @Disabled("This is integration test!") @Test @Disabled("No response is received") //TODO: See https://github.com/orgs/LimeChain/projects/16?pane=issue&itemId=40022251