|
|
@ -156,8 +156,24 @@ Future<TestNextcloudClient> getTestClient( |
|
|
|
return client; |
|
|
|
return client; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Future<DockerContainer> getDockerContainer(final DockerImage image) async { |
|
|
|
Future<DockerContainer> getDockerContainer() async { |
|
|
|
late ProcessResult result; |
|
|
|
const dockerImageName = 'ghcr.io/nextcloud/neon/dev'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = await runExecutableArguments( |
|
|
|
|
|
|
|
'docker', |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'images', |
|
|
|
|
|
|
|
'-q', |
|
|
|
|
|
|
|
dockerImageName, |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (result.exitCode != 0) { |
|
|
|
|
|
|
|
throw Exception('Querying docker image failed: ${result.stderr}'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (result.stdout.toString().isEmpty) { |
|
|
|
|
|
|
|
throw Exception('Missing docker image $dockerImageName. Please build it using ./tool/build-dev-container.sh'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
late int port; |
|
|
|
late int port; |
|
|
|
while (true) { |
|
|
|
while (true) { |
|
|
|
port = randomPort(); |
|
|
|
port = randomPort(); |
|
|
@ -171,7 +187,7 @@ Future<DockerContainer> getDockerContainer(final DockerImage image) async { |
|
|
|
'host.docker.internal:host-gateway', |
|
|
|
'host.docker.internal:host-gateway', |
|
|
|
'-p', |
|
|
|
'-p', |
|
|
|
'$port:80', |
|
|
|
'$port:80', |
|
|
|
image, |
|
|
|
dockerImageName, |
|
|
|
], |
|
|
|
], |
|
|
|
); |
|
|
|
); |
|
|
|
// 125 means the docker run command itself has failed which indicated the port is already used |
|
|
|
// 125 means the docker run command itself has failed which indicated the port is already used |
|
|
@ -190,35 +206,6 @@ Future<DockerContainer> getDockerContainer(final DockerImage image) async { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
typedef DockerImage = String; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<DockerImage> getDockerImage() async { |
|
|
|
|
|
|
|
const dockerImageName = 'nextcloud-neon-dev'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final inputStream = StreamController<List<int>>(); |
|
|
|
|
|
|
|
final process = runExecutableArguments( |
|
|
|
|
|
|
|
'docker', |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'build', |
|
|
|
|
|
|
|
'-t', |
|
|
|
|
|
|
|
dockerImageName, |
|
|
|
|
|
|
|
'-f', |
|
|
|
|
|
|
|
'-', |
|
|
|
|
|
|
|
'../../tool', |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
stdin: inputStream.stream, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
inputStream.add(utf8.encode(File('../../tool/Dockerfile.dev').readAsStringSync())); |
|
|
|
|
|
|
|
await inputStream.close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final result = await process; |
|
|
|
|
|
|
|
if (result.exitCode != 0) { |
|
|
|
|
|
|
|
throw Exception('Failed to build docker image'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return dockerImageName; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestNextcloudUser { |
|
|
|
class TestNextcloudUser { |
|
|
|
TestNextcloudUser( |
|
|
|
TestNextcloudUser( |
|
|
|
this.username, |
|
|
|
this.username, |
|
|
|