diff options
author | stuconnolly <stuart02@gmail.com> | 2013-01-22 18:08:30 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2013-01-22 18:08:30 +0000 |
commit | 0b698d969edb192a20e3c6b4e53728e732dbecde (patch) | |
tree | 5cf7c9890ccd6da927e548c8fd1948432c4a1cd6 /Frameworks/PostgresKit | |
parent | 9ab31cc5b60bf0e4519c989a3e9d213da50f888d (diff) | |
download | sequelpro-0b698d969edb192a20e3c6b4e53728e732dbecde.tar.gz sequelpro-0b698d969edb192a20e3c6b4e53728e732dbecde.tar.bz2 sequelpro-0b698d969edb192a20e3c6b4e53728e732dbecde.zip |
PostgresKit: Fix tests intermittently failing due to connection not being established.
Diffstat (limited to 'Frameworks/PostgresKit')
-rw-r--r-- | Frameworks/PostgresKit/Tests/PGDataTypeTests.m | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Frameworks/PostgresKit/Tests/PGDataTypeTests.m b/Frameworks/PostgresKit/Tests/PGDataTypeTests.m index c775049f..c9f70772 100644 --- a/Frameworks/PostgresKit/Tests/PGDataTypeTests.m +++ b/Frameworks/PostgresKit/Tests/PGDataTypeTests.m @@ -92,8 +92,6 @@ static NSUInteger PGTestDatabasePort = 5432; [self setConnection:connection]; [self setExpectedResult:result]; [self setField:field]; - - [self _establishConnection]; } return self; @@ -104,6 +102,8 @@ static NSUInteger PGTestDatabasePort = 5432; - (void)setUp { + [self _establishConnection]; + PGPostgresResult *queryResult = [_connection executeWithFormat:@"SELECT \"%@_field\" FROM \"data_types\"", _field]; [self setResult:[[queryResult row] objectForKey:[NSString stringWithFormat:@"%@_field", _field]]]; @@ -138,9 +138,14 @@ static NSUInteger PGTestDatabasePort = 5432; [_connection setDatabase:PGTestDatabaseName]; [_connection setPassword:PGTestDatabasePassword]; - if (![_connection connect] || ![_connection isConnected]) { - STFail(@"Unable to establish connection to local database. All tests will fail."); + if (![_connection connect]) { + STFail(@"Request to establish connection to local database failed."); } + + do { + sleep(0.1); + } + while (![_connection isConnected]); } + (void)_addTestForField:(NSString *)field |