Skip to content

Commit 12a96b4

Browse files
feat: updated smoke test help to debug intermittent failure (#2420)
Signed-off-by: Jeffrey Tang <[email protected]>
1 parent 8127c55 commit 12a96b4

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

.github/workflows/script/solo_smoke_test.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ function start_contract_test ()
7272
result=0
7373
npm run hh:test || result=$?
7474
cd -
75+
76+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
77+
echo "Test local network connection using nc"
78+
sudo apt-get update && sudo apt-get install -y netcat-traditional
79+
nc -zv 127.0.0.1 50211
80+
fi
81+
7582
if [[ $result -ne 0 ]]; then
7683
echo "Smart contract test failed with exit code $result"
7784
log_and_exit $result
@@ -159,6 +166,11 @@ function log_and_exit()
159166
cat relay.log || true
160167
echo "------- END RELAY DUMP -------"
161168

169+
echo "------- BEGIN MIRROR REST DUMP -------"
170+
kubectl get services -n "${SOLO_NAMESPACE}" --output=name | grep rest | grep -v '\-restjava' | xargs -IREST kubectl logs -n "${SOLO_NAMESPACE}" REST > rest.log || true
171+
cat rest.log || true
172+
echo "------- END MIRROR REST DUMP -------"
173+
162174
echo "------- Last port-forward check -------" >> port-forward.log
163175
ps -ef |grep port-forward >> port-forward.log
164176

@@ -193,7 +205,6 @@ fi
193205
create_test_account "${SOLO_DEPLOYMENT}"
194206
clone_smart_contract_repo
195207
setup_smart_contract_test
196-
start_background_transactions
197208
check_port_forward
198209
start_contract_test
199210
start_sdk_test "${REALM_NUM}" "${SHARD_NUM}"

examples/create-topic.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async function main() {
7272
console.log(`topic id = ${createReceipt.topicId.toString()}`);
7373

7474
console.log('Wait to create subscribe to new topic');
75-
await sleep(25000);
75+
await sleep(3000);
7676

7777
// Create a subscription to the topic
7878
const mirrorClient = (await Client.forMirrorNetwork(mirrorNetwork)).setOperator(
@@ -84,8 +84,6 @@ async function main() {
8484
let finished = false;
8585
new TopicMessageQuery()
8686
.setTopicId(createReceipt.topicId)
87-
.setMaxAttempts(400)
88-
.setLimit(1)
8987
// eslint-disable-next-line no-unused-vars
9088
.subscribe(
9189
mirrorClient,
@@ -103,6 +101,8 @@ async function main() {
103101
},
104102
);
105103

104+
await sleep(3000);
105+
106106
// send one message
107107
let topicMessageSubmitTransaction = await new TopicMessageSubmitTransaction({
108108
topicId: createReceipt.topicId,
@@ -150,7 +150,7 @@ async function main() {
150150
});
151151
});
152152
req.on('error', e => {
153-
console.log(`problem with request: ${e.message}`);
153+
console.log(`problem with request, message = : ${e.message} cause = : ${e.cause}`);
154154
});
155155
req.end(); // make the request
156156
// wait and try again

test/e2e/commands/tests/mirror-node-test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,11 @@ export class MirrorNodeTest extends BaseCommandTest {
179179
const transactionsEndpoint: string = 'http://localhost:5551/api/v1/transactions';
180180
const firstResponse = await fetch(transactionsEndpoint);
181181
const firstData = await firstResponse.json();
182-
await sleep(Duration.ofSeconds(10));
182+
console.log(`firstData = ${JSON.stringify(firstData, null, 2)}`);
183+
await sleep(Duration.ofSeconds(15));
183184
const secondResponse = await fetch(transactionsEndpoint);
184185
const secondData = await secondResponse.json();
186+
console.log(`secondData = ${JSON.stringify(secondData, null, 2)}`);
185187
expect(firstData.transactions).to.not.be.undefined;
186188
expect(firstData.transactions.length).to.be.gt(0);
187189
expect(secondData.transactions).to.not.be.undefined;

0 commit comments

Comments
 (0)