Skip to content

Commit

Permalink
Merge branch 'trunk' into feat_apkam_sync
Browse files Browse the repository at this point in the history
  • Loading branch information
sitaram-kalluri authored Oct 16, 2023
2 parents 5af23f2 + c7420de commit 252589e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
10 changes: 7 additions & 3 deletions tests/at_functional_test/test/check_docker_readiness.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ void main() {

test('checking for test environment readiness', () async {
_secureSocket = await secure_socket_connection(rootServer, atsignPort);
print('connection established');
socket_listener(_secureSocket);
String response = '';
while (response.isEmpty || response == 'data:null\n') {
while ((retryCount < maxRetryCount) &&
(response.isEmpty || response == 'data:null\n')) {
_secureSocket.write('lookup:signing_publickey$atsign\n');
response = await read();
print('waiting for signing public key response : $response');
await Future.delayed(Duration(milliseconds: 100));
if (response.startsWith('data:')) {
break;
}
}
await _secureSocket.close();
}, timeout: Timeout(Duration(minutes: 1)));
expect(response.startsWith('data:'), true);
});
}
14 changes: 9 additions & 5 deletions tests/at_functional_test/test/check_root_server_readiness.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ void main() {

late SecureSocket _secureSocket;

bool isRootServerStarted = false;

test('checking for root server readiness', () async {
while (retryCount < maxRetryCount) {
try {
Expand All @@ -25,16 +27,17 @@ void main() {
if (response == '@') {
print('Secure Socket is open for Root Server');
}
var isRootServerStarted =
await _lookupForSecondaryAddress(_secureSocket, atSign, rootServer);
isRootServerStarted =
await _lookupForSecondaryAddress(_secureSocket, atSign, rootServer);
if (isRootServerStarted) {
print('Closing socket connection');
print('Root server started successfully');
_secureSocket.close();
break;
} else {
print('Failed to start root server');
print('Root server is not completely initialized');
_secureSocket.close();
break;
retryCount = retryCount + 1;
await Future.delayed(Duration(seconds: 5));
}
} on SocketException {
print('Waiting for the root server to start: RetryCount: $retryCount');
Expand All @@ -46,6 +49,7 @@ void main() {
retryCount = retryCount + 1;
}
}
expect(isRootServerStarted, true, reason: 'Failed to start root server successfully');
}, timeout: Timeout(Duration(minutes: 1)));
}

Expand Down
14 changes: 12 additions & 2 deletions tests/at_functional_test/test/check_test_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ void main() {
var rootServer = 'vip.ve.atsign.zone';
var atsign = '@sitaram🛠';
var atsignPort = 25017;
bool arePKAMKeysLoaded = false;
int maxRetryCount = 10;
int retryCount = 1;

test('checking for test environment readiness', () async {
_secureSocket = await secure_socket_connection(rootServer, atsignPort);
print('connection established');
socket_listener(_secureSocket);
String response = '';
while (response.isEmpty || response.startsWith('error:')) {
while ((retryCount < maxRetryCount) &&
(response.isEmpty || response.startsWith('error:'))) {
_secureSocket.write('lookup:pkaminstalled$atsign\n');
response = await read();
print('Waiting for PKAM keys to load : $response');
if (response.startsWith('data:')) {
arePKAMKeysLoaded = true;
break;
}
await Future.delayed(Duration(seconds: 1));
}
await _secureSocket.close();
}, timeout: Timeout(Duration(minutes: 1)));
expect(arePKAMKeysLoaded, true,
reason: 'PKAM Keys are not loaded successfully');
});
}

0 comments on commit 252589e

Please sign in to comment.