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

Asynchronous test passes ignoring timeout #349

Open
cyupa opened this issue Aug 12, 2013 · 4 comments
Open

Asynchronous test passes ignoring timeout #349

cyupa opened this issue Aug 12, 2013 · 4 comments

Comments

@cyupa
Copy link

cyupa commented Aug 12, 2013

Hi,

My test passes in under 1 sec even if I set a timeout of 30.0 sec for async calls.

it(@"should receive JSON NSDictionary for auth", ^{
            __block NSError *errorObject = nil;
            __block NSDictionary *response = nil;

            [client authUserWithUsername:@"user"
                                           password:@"pass"
                                             domain:nil
                                            success:^(AFHTTPRequestOperation *operation, id responseObject) {
                                                NSLog(@"RESPONSE: %@", responseObject);
                                                response = responseObject;
                                            }
                                            failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                                                NSLog(@"ERROR: %@", error);
                                                errorObject = error;
                                            }];


            [[expectFutureValue(response) shouldEventuallyBeforeTimingOutAfter(30.0)] beNonNil];
            [[expectFutureValue(errorObject) shouldEventuallyBeforeTimingOutAfter(30.0)] beNil];

        });

I tried with

[[expectFutureValue(theValue(response)) shouldEventuallyBeforeTimingOutAfter(30.0)] beNonNil];

and it does not ignore the timeout. It waits. But it seems wrong to use theValue() macro.

Any ideas?
Thanks

@dyba
Copy link

dyba commented Aug 12, 2013

I'm currently working on this. See #341

@cyupa
Copy link
Author

cyupa commented Aug 13, 2013

Also, shouldn't there be a way to tell the framework that the job has finished?
Something like done(); called on the block passed to the background thread. Currently it seems it waits for the response to arrive the exact amount specified in the timeout. If the answer comes earlier, it still waits for the timeout.

@supermarin
Copy link

@dyba ever got a chance to submit a PR for this?

@dyba
Copy link

dyba commented Mar 6, 2014

@supermarin I left my work on a branch on my repo but didn't get a chance to finish it. Not sure if I'll come around to it anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants