Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Xcode8 support + #12

Merged
merged 23 commits into from
Oct 1, 2016
Merged

Xcode8 support + #12

merged 23 commits into from
Oct 1, 2016

Conversation

slightair
Copy link
Contributor

  • Remove Quick & Nimble (use XCTest instead)
  • Convert test code to Swift3
  • Fix broken asynchronous test
  • API changes for Swift3
  • Update dependencies

@slightair slightair mentioned this pull request Sep 25, 2016
@slightair slightair merged commit 59fd955 into cookpad:master Oct 1, 2016
Copy link
Contributor

@giginet giginet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for my late reply.
I reviewed about 1 weeks ago however these had been pending 🙇

@@ -1,9 +1,6 @@
source 'https://github.com/CocoaPods/Specs'
use_frameworks!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary after removing Quick and Nimble?

logStore.clearAll()
}

func assertLogStoreLogCount(pattern: String, output: PUROutput, expectedCount: Int, line: Int = #line) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, this utility's name is verbose.
I suppose Swift 3 style naming
assertLogCount(for pattern: String, to output: PUROutput, shouldBe expectedCount: Int, on line: Int = #line)

let logger = PURLogger(configuration: loggerConfiguration)
let testLogStorage = loggerConfiguration.logStorage

XCTAssertEqual(testLogStorage.description, "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use String(describing: obj) instead of calling description directly


expectation(forNotification: Notification.Name.PURBufferedOutputDidTryWriteChunk.rawValue, object: nil, handler: nil)
// scheduled after 2sec
waitForExpectations(timeout: 3.0, handler: nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these timeouts are different between its above comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BufferedOutput schedules retry after 2s, 4s, 8s.
So test wait +1 seconds for every retries.

XCTAssertEqual(testLogStorage.description, "[filter.testXXX|aaa:123][filter.testXXX|bbb:456,ccc:789][filter.testXXX|eee:not filtered]")

logger.logStore().clearAll()
logger.shutdown()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seems to be execute on every test cases.
Would you execute them on tearDown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confused test methods behaviour. I fixed it. bcbff49

@slightair slightair mentioned this pull request Oct 1, 2016
4 tasks
slightair added a commit that referenced this pull request Oct 9, 2016
}
return self;
}

- (void)dealloc {
self.databaseReadWriteCompletionQueue = nil;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] This is unnecessary.

@@ -54,10 +51,15 @@ - (instancetype)initWithDatabasePath:(NSString *)databasePath
self = [super init];
if (self) {
_databasePath = databasePath;
_databaseReadWriteCompletionQueue = dispatch_queue_create("PureeLogStoreReadWriteCompletion", NULL);
Copy link
Contributor

@chuganzy chuganzy Oct 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the completion queue to the subthread one?
If you change, you need to add some lock-logics to PURBufferedOutput class.

I think using the main-thread makes it simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You introduce async DB readwrite #6 for avoid UI blocking.
I think better that is some BufferedOutput processes running on the background too.

Do you think that DB read write completion block should running on the main-thread?

Copy link
Contributor

@chuganzy chuganzy Nov 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

DB R/W process is too heavy, but compared to that, BufferedOutput's internal processes are not. Rather than that, using the main-thread makes it much more simpler.
Anyway, currently -(void)flush is called from multiple thread and may sometimes cause NSRangeException. We should decide it as soon as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review
#17

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

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

Successfully merging this pull request may close these issues.

3 participants