Migrate to go1.12 to simplify our cmd/http package (#7302)

Simplify the cmd/http package overall by removing
custom plain text v/s tls connection detection, by
migrating to go1.12 and choose minimum version
to be go1.12

Also remove all the vendored deps, since they
are not useful anymore.
This commit is contained in:
Harshavardhana
2019-04-02 18:28:39 -07:00
committed by kannappanr
parent 4c23e6fa55
commit 313a3a286a
2392 changed files with 540 additions and 683347 deletions
+12 -12
View File
@@ -37,29 +37,29 @@ func TestPrepareUpdateMessage(t *testing.T) {
{-72 * time.Hour, "another_update_url", ""},
{0, "another_update_url", ""},
{time.Hour, "", ""},
{1 * time.Second, "my_download_url", "now"},
{2 * time.Second, "my_download_url", "1 second ago"},
{0 * time.Second, "my_download_url", "now"},
{1 * time.Second, "my_download_url", "1 second ago"},
{37 * time.Second, "my_download_url", "37 seconds ago"},
{60 * time.Second, "my_download_url", "60 seconds ago"},
{60 * time.Second, "my_download_url", "1 minute ago"},
{61 * time.Second, "my_download_url", "1 minute ago"},
// Testcase index 10
{37 * time.Minute, "my_download_url", "37 minutes ago"},
{1 * time.Hour, "my_download_url", "60 minutes ago"},
{1 * time.Hour, "my_download_url", "1 hour ago"},
{61 * time.Minute, "my_download_url", "1 hour ago"},
{122 * time.Minute, "my_download_url", "2 hours ago"},
{24 * time.Hour, "my_download_url", "24 hours ago"},
{24 * time.Hour, "my_download_url", "1 day ago"},
{25 * time.Hour, "my_download_url", "1 day ago"},
{49 * time.Hour, "my_download_url", "2 days ago"},
{7 * 24 * time.Hour, "my_download_url", "7 days ago"},
{7 * 24 * time.Hour, "my_download_url", "1 week ago"},
{8 * 24 * time.Hour, "my_download_url", "1 week ago"},
{15 * 24 * time.Hour, "my_download_url", "2 weeks ago"},
// Testcase index 20
{30 * 24 * time.Hour, "my_download_url", "4 weeks ago"},
{30 * 24 * time.Hour, "my_download_url", "1 month ago"},
{31 * 24 * time.Hour, "my_download_url", "1 month ago"},
{61 * 24 * time.Hour, "my_download_url", "2 months ago"},
{360 * 24 * time.Hour, "my_download_url", "12 months ago"},
{360 * 24 * time.Hour, "my_download_url", "1 year ago"},
{361 * 24 * time.Hour, "my_download_url", "1 year ago"},
{2 * 365 * 24 * time.Hour, "my_download_url", "2 years ago"},
}
@@ -74,17 +74,17 @@ func TestPrepareUpdateMessage(t *testing.T) {
// fmt.Println(output)
switch {
case testCase.dlURL == "" && output != "":
t.Errorf("Testcase %d: no newer release available but got an update message: %s", i, output)
t.Errorf("Testcase %d: no newer release available but got an update message: %s", i+1, output)
case output == "" && testCase.dlURL != "" && testCase.older > 0:
t.Errorf("Testcase %d: newer release is available but got empty update message!", i)
t.Errorf("Testcase %d: newer release is available but got empty update message!", i+1)
case output == "" && (testCase.dlURL == "" || testCase.older <= 0):
// Valid no update message case. No further
// validation needed.
continue
case !strings.Contains(output, line1):
t.Errorf("Testcase %d: output '%s' did not contain line 1: '%s'", i, output, line1)
t.Errorf("Testcase %d: output '%s' did not contain line 1: '%s'", i+1, output, line1)
case !strings.Contains(output, line2):
t.Errorf("Testcase %d: output '%s' did not contain line 2: '%s'", i, output, line2)
t.Errorf("Testcase %d: output '%s' did not contain line 2: '%s'", i+1, output, line2)
}
}
}