Skip to content

Commit 49fae11

Browse files
committed
refactor: all new testing architecture
Signed-off-by: Rob Walworth <[email protected]>
1 parent 6dd6ea2 commit 49fae11

File tree

570 files changed

+26377
-14696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

570 files changed

+26377
-14696
lines changed

.env.backup

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##
2+
# Environment variables for sdk examples
3+
##
4+
# Account that will pay query and transaction fees
5+
#OPERATOR_ID=0.0.3661843
6+
7+
# Default private key to use to sign for all transactions and queries
8+
#OPERATOR_KEY=302e020100300506032b657004220420e9d64b1a5788a1f3fe0023e67e5cc5c475ef2e9c7e717f1cce684ef74cc11526
9+
10+
# Network names: `"localhost"`, `"testnet"`, `"previewnet"`, `"mainnet"`
11+
#HEDERA_NETWORK=testnet
12+
TEST_PROFILE=fullLocal
13+
TEST_OPERATOR_KEY=302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137
14+
TEST_OPERATOR_ID=0.0.2

.env.example

Lines changed: 130 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,136 @@
1-
##
2-
# Environment variables for sdk examples
3-
##
4-
# Account that will pay query and transaction fees
5-
OPERATOR_ID=
1+
# =============================================================================
2+
# Hiero SDK Swift - Environment Configuration
3+
# =============================================================================
4+
# Copy this file to .env and fill in your values.
5+
# All HIERO_* variables are used by the test suite.
6+
# OPERATOR_* variables are used by the SDK examples.
67

7-
# Default private key to use to sign for all transactions and queries
8-
OPERATOR_KEY=
8+
# =============================================================================
9+
# SDK Examples Configuration
10+
# =============================================================================
11+
# These variables are used when running the examples in the Examples/ directory.
912

10-
# Network names: `"localhost"`, `"testnet"`, `"previewnet"`, `"mainnet"`
11-
NETWORK_NAME=
13+
# Account ID that will pay query and transaction fees for examples
14+
# Format: shard.realm.num (e.g., 0.0.1234)
15+
OPERATOR_ID=0.0.1234
1216

13-
##
14-
# Environment variables for integration tests
15-
##
16-
# Network names: `"localhost"`, `"testnet"`, `"previewnet"`, `"mainnet"`
17-
TEST_OPERATOR_ID=
17+
# Private key to sign transactions and queries for examples
18+
# Format: DER-encoded hex string
19+
OPERATOR_KEY=302e020100300506032b657004220420...
1820

19-
# Default private key to use to sign for all transactions and queries
20-
TEST_OPERATOR_KEY=
21+
# Network to connect to for examples
22+
# Values: localhost, testnet, previewnet, mainnet
23+
NETWORK_NAME=testnet
2124

22-
# Network names: `"localhost"`, `"testnet"`, `"previewnet"`, `"mainnet"`
23-
TEST_NETWORK_NAME=
25+
# =============================================================================
26+
# Integration Tests - Required Configuration
27+
# =============================================================================
28+
# These variables are required to run integration tests (HieroIntegrationTests).
29+
# Unit tests (HieroUnitTests) do not require any environment configuration.
2430

25-
# Enables non-free transactions when testing
26-
TEST_RUN_NONFREE=1
31+
# Account ID that will pay query and transaction fees for tests
32+
# Format: shard.realm.num (e.g., 0.0.1234)
33+
HIERO_OPERATOR_ID=0.0.1234
34+
35+
# Private key to sign transactions and queries for tests
36+
# Format: DER-encoded hex string
37+
HIERO_OPERATOR_KEY=302e020100300506032b657004220420...
38+
39+
# =============================================================================
40+
# Integration Tests - Network Configuration
41+
# =============================================================================
42+
43+
# Environment type - determines which network to connect to
44+
# Values: unit, local, testnet, previewnet, mainnet, custom
45+
# Default: Determined by HIERO_PROFILE (local profile uses 'local')
46+
HIERO_ENVIRONMENT_TYPE=testnet
47+
48+
# =============================================================================
49+
# Integration Tests - Custom Network Configuration
50+
# =============================================================================
51+
# Only needed when HIERO_ENVIRONMENT_TYPE=custom
52+
53+
# Comma-separated list of consensus node addresses
54+
# Format: host:port,host:port,...
55+
# Example: 127.0.0.1:50211,192.168.1.100:50211
56+
HIERO_CONSENSUS_NODES=
57+
58+
# Comma-separated list of consensus node account IDs (must match HIERO_CONSENSUS_NODES count)
59+
# Format: shard.realm.num,shard.realm.num,...
60+
# Example: 0.0.3,0.0.4
61+
HIERO_CONSENSUS_NODE_ACCOUNT_IDS=
62+
63+
# Comma-separated list of mirror node addresses
64+
# Format: host:port,host:port,...
65+
# Example: 127.0.0.1:5600 or mainnet.mirrornode.hedera.com:443
66+
HIERO_MIRROR_NODES=
67+
68+
# =============================================================================
69+
# Integration Tests - Test Profile
70+
# =============================================================================
71+
72+
# Test profile - provides pre-configured defaults for different scenarios
73+
# Values:
74+
# local - Local development with local node (default)
75+
# ciUnit - CI unit tests (unit environment)
76+
# ciIntegration - CI integration tests (local environment, verbose logging)
77+
# development - Development against remote networks (testnet)
78+
# Default: local
79+
HIERO_PROFILE=local
80+
81+
# =============================================================================
82+
# Integration Tests - Feature Flags
83+
# =============================================================================
84+
85+
# Maximum test duration in seconds before timeout
86+
# Default: 300 (5 minutes)
87+
HIERO_MAX_DURATION=300
88+
89+
# Enable parallel test execution
90+
# Values: 1 (enabled), 0 or unset (disabled)
91+
# Note: Parallel execution is not yet implemented
92+
# Default: disabled
93+
HIERO_PARALLEL=0
94+
95+
# Enable verbose logging during tests
96+
# Values: 1 (enabled), 0 or unset (disabled)
97+
# Default: disabled
98+
HIERO_VERBOSE=0
99+
100+
# =============================================================================
101+
# Integration Tests - Cleanup Policy
102+
# =============================================================================
103+
# Controls automatic cleanup of test resources after tests complete.
104+
# Cleanup economics:
105+
# - Accounts/Contracts: Cleanup RECOVERS HBAR (recommended)
106+
# - Tokens/Files/Topics: Cleanup COSTS HBAR (optional)
107+
108+
# Master cleanup switch - overrides all individual settings
109+
# Values: 1 (enable all cleanup), 0 (disable all cleanup), unset (use individual settings)
110+
# When set, ignores all HIERO_CLEANUP_* individual settings
111+
HIERO_ENABLE_CLEANUP=
112+
113+
# Clean up test accounts after tests (recovers locked HBAR)
114+
# Values: 1 (enabled), 0 (disabled)
115+
# Default: 1 (enabled) - Recommended
116+
HIERO_CLEANUP_ACCOUNTS=1
117+
118+
# Clean up test contracts after tests (can recover HBAR)
119+
# Values: 1 (enabled), 0 (disabled)
120+
# Default: 1 (enabled) - Recommended
121+
HIERO_CLEANUP_CONTRACTS=1
122+
123+
# Clean up test tokens after tests (costs HBAR, no recovery)
124+
# Values: 1 (enabled), 0 (disabled)
125+
# Default: 0 (disabled)
126+
HIERO_CLEANUP_TOKENS=0
127+
128+
# Clean up test files after tests (costs HBAR, no recovery)
129+
# Values: 1 (enabled), 0 (disabled)
130+
# Default: 0 (disabled)
131+
HIERO_CLEANUP_FILES=0
132+
133+
# Clean up test topics after tests (costs HBAR, no recovery)
134+
# Values: 1 (enabled), 0 (disabled)
135+
# Default: 0 (disabled)
136+
HIERO_CLEANUP_TOPICS=0

.github/workflows/swift-ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ jobs:
107107
run: |
108108
swift build
109109
110+
- name: Write .env for unit tests
111+
run: |
112+
umask 077
113+
{
114+
echo "HIERO_PROFILE=ciUnit"
115+
} > .env
116+
cat .env
117+
110118
- name: Run unit tests (HieroTests)
111119
run: swift test --filter HieroTests
112120

@@ -118,14 +126,13 @@ jobs:
118126
mirrorNodeVersion: v0.142.0
119127
hieroVersion: v0.68.0
120128

121-
- name: Write .env for tests
129+
- name: Write .env for integration tests
122130
run: |
123131
umask 077
124132
{
125-
echo "TEST_NETWORK_NAME=localhost"
126-
echo "TEST_RUN_NONFREE=1"
127-
echo "TEST_OPERATOR_ID=0.0.2"
128-
echo "TEST_OPERATOR_KEY=302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"
133+
echo "HIERO_PROFILE=ciIntegration"
134+
echo "HIERO_OPERATOR_ID=0.0.2"
135+
echo "HIERO_OPERATOR_KEY=302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137"
129136
} > .env
130137
cat .env
131138

Examples/ConsensusPubSubChunked/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal enum Program {
3131
try await Task.sleep(nanoseconds: 1_000_000_000 * 10)
3232

3333
_ = Task {
34-
let bigContents = try await HieroExampleUtilities.Resources.bigContents
34+
let bigContents = HieroExampleUtilities.Resources.bigContents
3535

3636
print(
3737
"about to prepare a transaction to send a message of \(bigContents.count) bytes"

Examples/CreateSimpleContract/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal enum Program {
1212

1313
client.setOperator(env.operatorAccountId, env.operatorKey)
1414

15-
let bytecode = try await HieroExampleUtilities.Resources.simpleContract
15+
let bytecode = HieroExampleUtilities.Resources.simpleContract
1616

1717
// create the contract's bytecode file
1818
let fileTransactionResponse = try await FileCreateTransaction()

Examples/CreateStatefulContract/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal enum Program {
1212

1313
client.setOperator(env.operatorAccountId, env.operatorKey)
1414

15-
let bytecode = try await HieroExampleUtilities.Resources.statefulContract
15+
let bytecode = HieroExampleUtilities.Resources.statefulContract
1616

1717
// create the contract's bytecode file
1818
let fileTransactionResponse = try await FileCreateTransaction()

Examples/FileAppendChunked/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import SwiftDotenv
55
@main
66
internal enum Program {
77
internal static func main() async throws {
8-
async let bigContents = HieroExampleUtilities.Resources.bigContents
8+
let bigContents = HieroExampleUtilities.Resources.bigContents
99
let env = try Dotenv.load()
1010
let client = try Client.forName(env.networkName)
1111

Examples/MirrorNodeContractQuery/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal enum Program {
1515
client.setOperator(env.operatorAccountId, env.operatorKey)
1616

1717
/// Grab the contract bytecode.
18-
let bytecode = try await HieroExampleUtilities.Resources.simpleContract
18+
let bytecode = HieroExampleUtilities.Resources.simpleContract
1919

2020
// Create the contract's bytecode file.
2121
var txResponse = try await FileCreateTransaction()

0 commit comments

Comments
 (0)