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

Bugs/handle dst #29

Merged
merged 2 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions http_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

func TestHTTPSourceLatestVersion(t *testing.T) {
client := http.Client{Timeout: time.Duration(60) * time.Second}
httpSource := NewHTTPSource(&client, "http://geoffrey-test-artefacts.fynelabs.com/nomad-windows-amd64.exe")
httpSource := NewHTTPSource(&client, "http://geoffrey-test-artefacts.fynelabs.com/self-update/Nomad.exe")

version, err := httpSource.LatestVersion()
assert.Nil(t, err)
Expand All @@ -24,18 +24,18 @@ func TestHTTPSourceLatestVersion(t *testing.T) {
func TestHTTPSourceCheckSignature(t *testing.T) {
client := http.Client{Timeout: time.Duration(60) * time.Second}

publicKey := ed25519.PublicKey{178, 103, 83, 57, 61, 138, 18, 249, 244, 80, 163, 162, 24, 251, 190, 241, 11, 168, 179, 41, 245, 27, 166, 70, 220, 254, 118, 169, 101, 26, 199, 129}
publicKey := ed25519.PublicKey{231, 120, 42, 245, 227, 182, 133, 19, 197, 251, 215, 216, 34, 35, 16, 183, 184, 174, 55, 30, 107, 18, 43, 136, 111, 68, 168, 138, 176, 212, 156, 124}
wrongPublicKey := ed25519.PublicKey{42, 103, 83, 57, 61, 138, 18, 249, 244, 80, 163, 162, 24, 251, 190, 241, 11, 168, 179, 41, 245, 27, 166, 70, 220, 254, 118, 169, 101, 26, 199, 129}

httpSource := NewHTTPSource(&client, "http://geoffrey-test-artefacts.fynelabs.com/nomad-windows-amd64.exe")
httpSource := NewHTTPSource(&client, "http://geoffrey-test-artefacts.fynelabs.com/self-update/Nomad.exe")
signature, err := httpSource.GetSignature()
assert.Nil(t, err)

file, contentLength, err := httpSource.Get(&Version{Date: time.Unix(100, 0)})
log.Println(file, " -- ", err)
assert.Nil(t, err)
assert.NotNil(t, file)
assert.Equal(t, int64(32099400), contentLength)
assert.Equal(t, int64(19320832), contentLength)

body, err := ioutil.ReadAll(file)
assert.Nil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (u *Updater) CheckNow() error {
return err
}

v = &Version{Date: mtime}
v = &Version{Date: mtime.In(time.UTC)}
}

latest, err := u.conf.Source.LatestVersion()
Expand Down