File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ - (QNRequestTransaction *)createUploadRequestTransaction:(QNUpToken *)token{
210210 if (self.ucHosts && self.ucHosts .count > 0 ) {
211211 hosts = [self .ucHosts copy ];
212212 } else {
213- hosts = @[kQNPreQueryHost00 , kQNPreQueryHost01 ];
213+ hosts = @[kQNPreQueryHost02 , kQNPreQueryHost00 , kQNPreQueryHost01 ];
214214 }
215215 QNRequestTransaction *transaction = [[QNRequestTransaction alloc ] initWithHosts: hosts
216216 regionId: QNZoneInfoEmptyRegionId
Original file line number Diff line number Diff line change 1111// MARK: -- 内部布置 尽量不要修改
1212#define kQNPreQueryHost00 @" uc.qbox.me"
1313#define kQNPreQueryHost01 @" api.qiniu.com"
14+ #define kQNPreQueryHost02 @" kodo-config.qiniuapi.com"
1415#define kQNUpLogHost @" uplog.qbox.me"
Original file line number Diff line number Diff line change 2020#import " QNZoneInfo.h"
2121#import " QNTestConfig.h"
2222#import " QNUpToken.h"
23+ #import " QNConfig.h"
2324
2425@interface QNAutoZoneTest : XCTestCase
2526@property QNAutoZone* autozone;
@@ -37,6 +38,32 @@ - (void)tearDown {
3738 [super tearDown ];
3839}
3940
41+ - (void )testAutoZone {
42+ QNAutoZone* autoZone = [[QNAutoZone alloc ] init ];
43+ QNUpToken* tok = [QNUpToken parse: token_na0];
44+ __block int x = 0 ;
45+ __block int c = 0 ;
46+ [autoZone preQuery: tok on: ^(int code, QNResponseInfo *info, QNUploadRegionRequestMetrics *metrics) {
47+ x = 1 ;
48+ c = code;
49+ }];
50+ AGWW_WAIT_WHILE (x == 0 , 100.0 );
51+ XCTAssertEqual (0 , c, @" c: %d " , c);
52+ }
53+
54+ - (void )testSetUcHosts02 {
55+ QNAutoZone* autoZone = [QNAutoZone zoneWithUcHosts: @[kQNPreQueryHost02 ]];
56+ QNUpToken* tok = [QNUpToken parse: token_na0];
57+ __block int x = 0 ;
58+ __block int c = 0 ;
59+ [autoZone preQuery: tok on: ^(int code, QNResponseInfo *info, QNUploadRegionRequestMetrics *metrics) {
60+ x = 1 ;
61+ c = code;
62+ }];
63+ AGWW_WAIT_WHILE (x == 0 , 100.0 );
64+ XCTAssertEqual (0 , c, @" c: %d " , c);
65+ }
66+
4067- (void )testClearAutoZoneCache {
4168 QNAutoZone *autoZone = [[QNAutoZone alloc ] init ];
4269 QNUpToken* tok = [QNUpToken parse: token_na0];
You can’t perform that action at this time.
0 commit comments