Skip to content

Commit

Permalink
needs some testing
Browse files Browse the repository at this point in the history
  • Loading branch information
j4qfrost committed Jun 6, 2024
1 parent e1a9d18 commit b9d9a60
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 33 deletions.
5 changes: 2 additions & 3 deletions packages/cli/lib/src/commands/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CLIBuild extends CLICommand with CLIProject {
.toFilePath(windows: Platform.isWindows),
).absolute;

@Option("define",
@MultiOption("define",
help:
"Adds an environment variable to use during runtime. This can be added more than once.",
abbr: "D")
Expand All @@ -51,6 +51,7 @@ class CLIBuild extends CLICommand with CLIProject {
buildDirectory.uri,
root.resolve("$packageName.aot"),
getScriptSource(await getChannelName()),
environment: environment,
);

print("Starting build process...");
Expand Down Expand Up @@ -153,15 +154,13 @@ Future _runnerFunc(List<String> args, dynamic sendPort) async {
}

final app = Application<ApplicationChannel>();

app.options = ApplicationOptions()
..port = int.parse(values['port'] as String)
..address = values['address']
..isIpv6Only = values['ipv6-only'] == true
..configurationFilePath = values['config-path'] as String?
..certificateFilePath = values['ssl-certificate-path'] as String?
..privateKeyFilePath = values['ssl-key-path'] as String?;

final isolateCountString = values['isolates'];
if (isolateCountString == null) {
await app.startOnCurrentIsolate();
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ dev_dependencies:
fs_test_agent:
path: ../fs_test_agent
http: ^1.2.1
lints: ^3.0.0
lints: ^4.0.0
matcher: ^0.12.16+1
mockito: ^5.4.4
test: ^1.25.2
web_socket_channel: ^2.4.4
web_socket_channel: ^3.0.0

executables:
conduit: conduit
2 changes: 1 addition & 1 deletion packages/codable/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencies:
meta: ^1.3.0

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/common/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ dependencies:
conduit_open_api: ^5.1.1

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
2 changes: 1 addition & 1 deletion packages/config/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ dependencies:
yaml: ^3.1.2

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/core/lib/src/application/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ class ApplicationOptions {
///
/// This is a user-specific set of configuration options provided by [ApplicationChannel.initializeApplication].
/// Each instance of [ApplicationChannel] has access to these values if set.
Map<String, dynamic> context = {};
final Map<String, dynamic> context = {};
}
4 changes: 2 additions & 2 deletions packages/core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ dev_dependencies:
fs_test_agent:
path: ../fs_test_agent
http: ^1.2.1
lints: ^3.0.0
lints: ^4.0.0
matcher: ^0.12.16+1
mockito: ^5.4.4
test: ^1.25.2
web_socket_channel: ^2.4.4
web_socket_channel: ^3.0.0
6 changes: 3 additions & 3 deletions packages/core/test/http/application_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,22 @@ void main() {
final crashingApp = Application<CrashingTestChannel>();

try {
crashingApp.options.context = {"crashIn": "addRoutes"};
crashingApp.options.context["crashIn"] = "addRoutes";
await crashingApp.startOnCurrentIsolate();
expect(true, false);
} on Exception catch (e) {
expect(e.toString(), contains("addRoutes"));
}

try {
crashingApp.options.context = {"crashIn": "prepare"};
crashingApp.options.context["crashIn"] = "prepare";
await crashingApp.startOnCurrentIsolate();
expect(true, false);
} on Exception catch (e) {
expect(e.toString(), contains("prepare"));
}

crashingApp.options.context = {"crashIn": "dontCrash"};
crashingApp.options.context["crashIn"] = "dontCrash";
await crashingApp.startOnCurrentIsolate();
final response = await http.get(Uri.parse("http://localhost:8888/t"));
expect(response.statusCode, 200);
Expand Down
10 changes: 5 additions & 5 deletions packages/core/test/http/isolate/isolate_failure_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ void main() {
final crashingApp = Application<CrashChannel>();

try {
crashingApp.options.context = {"crashIn": "addRoutes"};
crashingApp.options.context["crashIn"] = "addRoutes";
await crashingApp.start(consoleLogging: true);
expect(true, false);
} on ApplicationStartupException catch (e) {
expect(e.toString(), contains("TestException: addRoutes"));
}

try {
crashingApp.options.context = {"crashIn": "prepare"};
crashingApp.options.context["crashIn"] = "prepare";
await crashingApp.start(consoleLogging: true);
expect(true, false);
} on ApplicationStartupException catch (e) {
expect(e.toString(), contains("TestException: prepare"));
}

crashingApp.options.context = {"crashIn": "dontCrash"};
crashingApp.options.context["crashIn"] = "dontCrash";
await crashingApp.start(consoleLogging: true);
final response = await http.get(Uri.parse("http://localhost:8888/t"));
expect(response.statusCode, 200);
Expand Down Expand Up @@ -62,7 +62,7 @@ void main() {
() async {
final timeoutApp = Application<TimeoutChannel>()
..isolateStartupTimeout = const Duration(seconds: 4)
..options.context = {"timeout1": 10};
..options.context["timeout1"] = 10;

try {
await timeoutApp.start(numberOfInstances: 2, consoleLogging: true);
Expand All @@ -80,7 +80,7 @@ void main() {
() async {
final timeoutApp = Application<TimeoutChannel>()
..isolateStartupTimeout = const Duration(seconds: 4)
..options.context = {"timeout2": 10};
..options.context["timeout2"] = 10;

try {
await timeoutApp.start(numberOfInstances: 2, consoleLogging: true);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/http/isolate/message_hub_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void main() {
() async {
app = Application<HubChannel>()
..options.port = 8000
..options.context = {"sendIn": "prepare"};
..options.context["sendIn"] = "prepare";
await app.start(numberOfInstances: 3);

expect(
Expand Down Expand Up @@ -85,7 +85,7 @@ void main() {
test("Message hub stream can have multiple listeners", () async {
app = Application<HubChannel>()
..options.port = 8000
..options.context = {"multipleListeners": true};
..options.context["multipleListeners"] = true;
await app.start(numberOfInstances: 3);

final resp = await postMessage("msg1");
Expand Down
2 changes: 1 addition & 1 deletion packages/fs_test_agent/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ dependencies:
pubspec_parse: ^1.2.3

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/isolate_exec/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
path: ^1.9.0

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
test_package:
path: ../isolate_exec_test_packages/test_package
2 changes: 1 addition & 1 deletion packages/open_api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ dependencies:
meta: ^1.12.0

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/password_hash/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencies:
crypto: ^3.0.3

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/postgresql/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ dependencies:
postgres: ^3.1.1

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
5 changes: 3 additions & 2 deletions packages/runtime/lib/src/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ class Build {
[
"compile",
"exe",
...context.environment?.entries.map((e) => "-D${e.key}=${e.value}") ??
[],
...(context.environment?.entries.map((e) => "-D${e.key}=${e.value}") ??
[]),
"-v",
srcUri.toFilePath(windows: Platform.isWindows),
"-o",
Expand All @@ -157,6 +157,7 @@ class Build {
.toFilePath(windows: Platform.isWindows),
runInShell: true,
);

if (res.exitCode != 0) {
throw StateError(
"'dart2native' failed with the following message: ${res.stderr}",
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ dependencies:
dev_dependencies:
fs_test_agent:
path: ../fs_test_agent
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/runtime_test_packages/application/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencies:
meta: ^1.3.0

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/runtime_test_packages/dependency/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ dependencies:
path: ../../runtime

dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.25.2
2 changes: 1 addition & 1 deletion packages/test_harness/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ dependencies:
dev_dependencies:
conduit_postgresql:
path: ../postgresql
lints: ^3.0.0
lints: ^4.0.0
test_core: ^0.6.0
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: conduit_workspace
version: 5.1.1
version: 5.1.2
home: https://www.theconduit.dev
repository: https://github.com/conduit-dart/conduit
issue_tracker: https://github.com/conduit-dart/conduit/issues
Expand Down

0 comments on commit b9d9a60

Please sign in to comment.