Skip to content

Commit

Permalink
fix: auto update cucumber tests, reduced timeout (#3418)
Browse files Browse the repository at this point in the history
Description
---
This fixes issues with the auto update tests.

Motivation and Context
---
Make it work

How Has This Been Tested?
---
Using cucumber.

I did add a string to the dns.rs query_txt() result to actually test, since I can't modify DNS TEXT records...

push "base-node:macos-aarch64:99.8.12:6e77da12535e0ed7851761ae6c6729f2dd3ae8050840e8c08e10e279dadfde8a"

maybe would could add the macos-aarch64 to the DNS record?
  • Loading branch information
Impala123 authored Oct 5, 2021
1 parent 9a369a0 commit ce17627
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
3 changes: 0 additions & 3 deletions integration_tests/features/BaseNodeAutoUpdate.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@auto_update
Feature: AutoUpdate

# Not sure why this takes so long on CI
@long-running @broken
Scenario: Auto update finds a new update on base node
Given I have a node NODE_A with auto update enabled
Then NODE_A has a new software update

@broken
Scenario: Auto update ignores update with invalid signature on base node
Given I have a node NODE_A with auto update configured with a bad signature
And I wait 10 seconds
Expand Down
3 changes: 0 additions & 3 deletions integration_tests/features/WalletAutoUpdate.feature
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@auto_update
Feature: AutoUpdate

# Not sure why this takes so long on CI
@long-running @broken
Scenario: Auto update finds a new update on wallet
Given I have a wallet WALLET with auto update enabled
Then WALLET has a new software update

@broken
Scenario: Auto update ignores update with invalid signature on wallet
Given I have a wallet WALLET with auto update configured with a bad signature
And I wait 10 seconds
Expand Down
30 changes: 18 additions & 12 deletions integration_tests/features/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const TransactionBuilder = require("../../helpers/transactionBuilder");
let lastResult;

const AUTOUPDATE_HASHES_TXT_URL =
"https://raw.githubusercontent.com/sdbondi/tari/autoupdate-test-branch/meta/hashes.txt";
"https://raw.githubusercontent.com/tari-project/tari/development/meta/hashes.txt";
const AUTOUPDATE_HASHES_TXT_SIG_URL =
"https://github.com/sdbondi/tari/raw/autoupdate-test-branch/meta/good.sig";
"https://raw.githubusercontent.com/tari-project/tari/development/meta/hashes.txt.sig";
const AUTOUPDATE_HASHES_TXT_BAD_SIG_URL =
"https://github.com/sdbondi/tari/raw/autoupdate-test-branch/meta/bad.sig";
"https://raw.githubusercontent.com/tari-project/tari/development/meta/hashes.txt.bad.sig";

Given(/I have a seed node (.*)/, { timeout: 20 * 1000 }, async function (name) {
return await this.createSeedNode(name);
Expand Down Expand Up @@ -91,6 +91,7 @@ Given(
const node = await this.createNode(name, {
common: {
auto_update: {
check_interval: 10,
enabled: true,
dns_hosts: ["_test_autoupdate.tari.io"],
hashes_url: AUTOUPDATE_HASHES_TXT_URL,
Expand All @@ -110,6 +111,7 @@ Given(
const node = await this.createNode(name, {
common: {
auto_update: {
check_interval: 10,
enabled: true,
dns_hosts: ["_test_autoupdate.tari.io"],
hashes_url: AUTOUPDATE_HASHES_TXT_URL,
Expand All @@ -129,6 +131,7 @@ Given(
await this.createAndAddWallet(name, "", {
common: {
auto_update: {
check_interval: 10,
enabled: true,
dns_hosts: ["_test_autoupdate.tari.io"],
hashes_url: AUTOUPDATE_HASHES_TXT_URL,
Expand All @@ -146,6 +149,7 @@ Given(
await this.createAndAddWallet(name, "", {
common: {
auto_update: {
check_interval: 10,
enabled: true,
dns_hosts: ["_test_autoupdate.tari.io"],
hashes_url: AUTOUPDATE_HASHES_TXT_URL,
Expand Down Expand Up @@ -970,12 +974,14 @@ Then(
let client = await this.getNodeOrWalletClient(name);
await sleep(5000);
await waitFor(
async () => client.checkForUpdates().has_update,
async () => (await client.checkForUpdates()).has_update,
false,
60 * 1000
);
expect(client.checkForUpdates().has_update, "There should be no update").to
.be.false;
expect(
(await client.checkForUpdates()).has_update,
"There should be no update"
).to.be.false;
}
);

Expand All @@ -985,14 +991,14 @@ Then(
async function (name) {
let client = await this.getNodeOrWalletClient(name);
await waitFor(
async () => {
return client.checkForUpdates().has_update;
},
async () => (await client.checkForUpdates()).has_update,
true,
1150 * 1000
60 * 1000
);
expect(client.checkForUpdates().has_update, "There should be update").to.be
.true;
expect(
(await client.checkForUpdates()).has_update,
"There should be update"
).to.be.true;
}
);

Expand Down
3 changes: 3 additions & 0 deletions integration_tests/helpers/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ function mapEnvs(options) {
? "true"
: "false";
}
if (auto_update.check_interval) {
res.TARI_COMMON__AUTO_UPDATE__CHECK_INTERVAL = auto_update.check_interval;
}
if (auto_update.dns_hosts) {
res.TARI_COMMON__AUTO_UPDATE__DNS_HOSTS = auto_update.dns_hosts.join(",");
}
Expand Down
Binary file added meta/hashes.txt.bad.sig
Binary file not shown.

0 comments on commit ce17627

Please sign in to comment.