Skip to content

Connecting without password times out  #65

Closed
@osaxma

Description

@osaxma

Here's a reproduction test:

import 'package:postgres/postgres.dart';
import 'package:test/test.dart';

import 'docker.dart';

void main() {
  usePostgresDocker();

  test('- connect without username throws', () async {
    final conn = PostgreSQLConnection('localhost', 5432, 'dart_test');

    expect(conn.open(), throwsA(isA<PostgreSQLException>()));
  });
  
  // this test will timeout 
  test('connects without password is fine', () async {
    final conn =
        PostgreSQLConnection('localhost', 5432, 'dart_test', username: 'dart');
    await conn.open();
    final res = await conn.query('select 1;');

    expect(res.length, 1);
  });
}

Actually several tests are failing due to this issue but they can only be seen locally as they are placed after this condition (e.g. Connect with no auth required test):

// These tests are disabled, as we'd need to setup ci/pg_hba.conf into the CI
// postgres instance first.
// TODO: re-enable these tests after pg_hba.conf is used
if (Platform.environment.containsKey('GITHUB_ACTION')) {
test('NO CONNECTION TEST IS RUNNING.', () {
// no-op
});
return;
}

Possible related PR:


I'm trying to make all tests run successfully, locally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions