UIKit0 / update-engine

Automatically exported from code.google.com/p/update-engine
Apache License 2.0
0 stars 0 forks source link

KSURLTest -testFailedDownload fails with OpenDNS #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use OpenDNS as your DNS server (ex: 208.67.222.222)
2. Run all unit tests
3. Look at -testFailedDownload

What is the expected output? What do you see instead?
Expected test to pass. Failed intead.

OpenDNS "helpfully" provides an http redirect when a website is not found, such 
as the one in 
the test ("qwdf...dzxerqwlka.com"). It looks like update-engine follows this 
redirect, and thus 
gets a valid return code since it got a valid response (eventually).

What version of the product are you using? On what operating system?

svn Version 39 on MacOSX 10.5.5 (Xcode 3.1.1).

Please provide any additional information below.

Suggest to either fix the test to look for either an invalid response (current 
code) or, if response 
is valid, check that it contains parseable data.

Alternatively, add a "no-follow-redirect" mode to update-engine, use that in 
the test, and test 
the redirection separately using a known redirect server.

Original issue reported on code.google.com by philippe...@gmail.com on 30 Sep 2008 at 12:59

GoogleCodeExporter commented 8 years ago
Fixed by making the test use a file: URL rather than the http: URL. "svn up" 
and tests should work.

Index: Core/Support/KSURLTest.m
===================================================================
--- Core/Support/KSURLTest.m    (revision 42)
+++ Core/Support/KSURLTest.m    (working copy)
@@ -117,9 +117,9 @@
   NSString *cmd = nil;
   int rc = -1;

-  // God help us all if someone actually buys the following domain.
+  // This file should not exist.
   cmd = [path_ stringByAppendingFormat:
-         @" -url http://www.qwdf23qf2e4f11wedzxerqwlka.com/ -path %@", 
dlpath_];
+         @" -url file:///qwdf23qf2e4f11wedzxerqwlka.test/ -path %@", dlpath_];
   rc = RunCommand(cmd);
   STAssertTrue(rc != 0, nil);

Original comment by dev...@gmail.com on 1 Oct 2008 at 12:15