Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patrol_cli ClientException with SocketException: Operation timed out #2499

Open
HXiaoMing opened this issue Jan 20, 2025 · 1 comment
Open
Assignees
Labels
package: patrol_cli Related to the patrol_cli package waiting for response Waiting for user's response

Comments

@HXiaoMing
Copy link

HXiaoMing commented Jan 20, 2025

Steps to reproduce

I want to create a simple integration test. But when I run patrol test -t integration_test/example_test.dart occur an error.
The error is :
ClientException with SocketException: Operation timed out (OS Error: Operation timed out, errno = 60), address = pub.dev, port = 52158, uri=https://pub.dev/api/packages/patrol_cli

I found the package pub_updater.The source code is _defaultBaseUrl = 'https://pub.dev'.
And the patrol_cli use final pubUpdater = PubUpdater(). it mean patrol_cli cannot use custom baseUrl for PubUpdater().
The 'https://pub.dev' is not accessible in my country, Could help me please?

It is possible patrol_cli read pubHostedUrl from the environment value PUB_HOSTED_URL. And Pass it to PubUpdater ?
Such as :
patrol_cli: patrol_command_runner.dart new source code like that:

Future<int> patrolCommandRunner(List<String> args) async {
  const platform = LocalPlatform();
  // Retrieve the value of the environment variable 'PUB_HOSTED_URL'
  final pubHostedUrl = platform.environment['PUB_HOSTED_URL'] ?? 'https://pub.dev';
  final pubUpdater = PubUpdater(null, pubHostedUrl);
  ...
}

patrol_cli: patrol_command_runner.dart origin source code:

Future<int> patrolCommandRunner(List<String> args) async {
  final pubUpdater = PubUpdater();
  ...
}

pub_updater : pub_updater.dart source code :


const _defaultBaseUrl = 'https://pub.dev';

class PubUpdater {
  /// {@macro pub_update}
  PubUpdater([http.Client? client, String baseUrl = _defaultBaseUrl])
      : _client = client,
        _baseUrl = baseUrl;
}

Actual results

run patrol test -t integration_test/example_test.dart occur an error.
The error is :
ClientException with SocketException: Operation timed out (OS Error: Operation timed out, errno = 60), address = pub.dev, port = 52158, uri=https://pub.dev/api/packages/patrol_cli
#0 IOClient.send (package:http/src/io_client.dart:154:7)

#1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:32)

#2 _withClient (package:http/http.dart:167:12)

#3 PubUpdater._getPackageInfo (package:pub_updater/src/pub_updater.dart:87:22)

#4 PubUpdater.getLatestVersion (package:pub_updater/src/pub_updater.dart:57:25)

#5 PatrolCommandRunner._checkForUpdate (package:patrol_cli/src/runner/patrol_command_runner.dart:413:27)

#6 PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:340:7)

#7 PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:292:18)

#8 patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:70:20)

Logs

Logs
ClientException with SocketException: Operation timed out (OS Error: Operation timed out, errno = 60), address = pub.dev, port = 52158, uri=https://pub.dev/api/packages/patrol_cli
#0      IOClient.send (package:http/src/io_client.dart:154:7)
<asynchronous suspension>
#1      BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:32)
<asynchronous suspension>
#2      _withClient (package:http/http.dart:167:12)
<asynchronous suspension>
#3      PubUpdater._getPackageInfo (package:pub_updater/src/pub_updater.dart:87:22)
<asynchronous suspension>
#4      PubUpdater.getLatestVersion (package:pub_updater/src/pub_updater.dart:57:25)
<asynchronous suspension>
#5      PatrolCommandRunner._checkForUpdate (package:patrol_cli/src/runner/patrol_command_runner.dart:413:27)
<asynchronous suspension>
#6      PatrolCommandRunner.runCommand (package:patrol_cli/src/runner/patrol_command_runner.dart:340:7)
<asynchronous suspension>
#7      PatrolCommandRunner.run (package:patrol_cli/src/runner/patrol_command_runner.dart:292:18)
<asynchronous suspension>
#8      patrolCommandRunner (package:patrol_cli/src/runner/patrol_command_runner.dart:70:20)
<asynchronous suspension>

Patrol version

patrol: ^3.7.1

Patrol Doctor output

Patrol Doctor output
<!-- Replace this line with your logs. Do not remove the backticks! -->

Flutter Doctor output

Flutter Doctor output
<!-- Replace this line with your logs. Do not remove the backticks! -->
@Kendru98
Copy link
Contributor

Hi @HXiaoMing, did you finish patrol setup? Also please attach patrol doctor, to see your patrol_cli version, and make sure that your config is compatibile https://patrol.leancode.co/documentation/compatibility-table. You can also join our discord maybe someone there can help, or have similar problem https://discord.com/invite/ukBK5t4EZg
Cheers, Kendruu

@Kendru98 Kendru98 added the waiting for response Waiting for user's response label Jan 31, 2025
@Kendru98 Kendru98 self-assigned this Jan 31, 2025
@Kendru98 Kendru98 added the package: patrol_cli Related to the patrol_cli package label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: patrol_cli Related to the patrol_cli package waiting for response Waiting for user's response
Projects
None yet
Development

No branches or pull requests

2 participants