simplify IP address linking for intergration test on emulator

This commit is contained in:
pokapow 2023-03-02 19:54:44 +01:00
parent c4b9eaf2ea
commit fd5d20ece9
4 changed files with 7 additions and 7 deletions

BIN
.env

Binary file not shown.

View File

@ -5,8 +5,9 @@ option=$2
[[ ! $testName ]] && testName='gecko_complete'
# Get local IP and set .env
ip_address=$(hostname -I | awk '{print $1}')
echo "ip_address=$ip_address" > .env
#ip_address=$(hostname -I 2>/dev/null || ipconfig 2>&1 | grep "IPv4 Address" | head -n1 | awk -F ':' '{ print $2}' | tr -d ' ') # old fashion style...
#ip_address="10.0.2.2"
#echo "ip_address=$ip_address" > .env
[[ $option == 'human' ]] && echo "isHumanReading=true" >> .env
## Start local Duniter node
@ -20,10 +21,10 @@ cd ../..
flutter test integration_test/scenarios/$testName.dart && echo '0' > /tmp/geckoTestResult || echo '1' > /tmp/geckoTestResult
# Reset .env
echo "ip_address=127.0.0.1" > .env
echo "ip_address=127.0.0.1" > .env # not used anymore, host IP is 10.0.2.2
# Stop Duniter
cd integration_test/duniter
docker compose down
exit 0

View File

@ -1,6 +1,5 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/widgets_keys.dart';
@ -11,7 +10,7 @@ import 'tests_utility.dart';
// GENERAL ACTIONS
Future changeNode() async {
final ipAddress = dotenv.env['ip_address'] ?? '127.0.0.1';
const ipAddress = '10.0.2.2';
log.d('ip address: $ipAddress');
await tapKey(keyDrawerMenu);

View File

@ -223,7 +223,7 @@ Future bkConfirmIdentity(
// Change node in background
Future bkSetNode([String? endpoint]) async {
if (endpoint == null) {
final ipAddress = dotenv.env['ip_address'] ?? '127.0.0.1';
const ipAddress = '10.0.2.2';
endpoint = 'ws://$ipAddress:9944';
}
configBox.put('customEndpoint', endpoint);