Pull request 2015: AG-23168-imp-updater-tests

Squashed commit of the following:

commit 402ac873839fcf4dfb762872497b740bd55b2dcc
Merge: 209e1b171 af38476ef
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Sep 21 16:46:47 2023 +0300

    Merge branch 'master' into AG-23168-imp-updater-tests

commit 209e1b171cb4c55d177ef5a4198cf24c2bc41195
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Sep 21 14:09:43 2023 +0300

    updater: fix windows build

commit d112ca53540e0c999fe126442e8c526ff7e33bf5
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed Sep 20 18:57:54 2023 +0300

    all: imp tests, docs

commit f940724f81a90af6c07de523c8fcce66240dbec9
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Wed Sep 20 16:07:48 2023 +0300

    all: imp tests

commit 8915818e81360a7f6ff5b652a983ca034ad6d0c4
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Tue Sep 19 19:33:20 2023 +0300

    all: add test

commit c1cb8df2b056cefc5d7f1b32c089cd0ede0af9d2
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Sep 14 19:12:47 2023 +0300

    updater: imp tests
This commit is contained in:
Stanislav Chzhen 2023-09-21 17:07:57 +03:00
parent af38476efa
commit 93ab0fde23
7 changed files with 369 additions and 280 deletions
internal/home

View file

@ -9,8 +9,10 @@ import (
"net"
"net/http"
"net/netip"
"net/url"
"os"
"os/signal"
"path"
"path/filepath"
"runtime"
"sync"
@ -559,16 +561,28 @@ func run(opts options, clientBuildFS fs.FS, done chan struct{}) {
err = setupOpts(opts)
fatalOnError(err)
execPath, err := os.Executable()
fatalOnError(errors.Annotate(err, "getting executable path: %w"))
u := &url.URL{
Scheme: "https",
// TODO(a.garipov): Make configurable.
Host: "static.adtidy.org",
Path: path.Join("adguardhome", version.Channel(), "version.json"),
}
upd := updater.NewUpdater(&updater.Config{
Client: config.Filtering.HTTPClient,
Version: version.Version(),
Channel: version.Channel(),
GOARCH: runtime.GOARCH,
GOOS: runtime.GOOS,
GOARM: version.GOARM(),
GOMIPS: version.GOMIPS(),
WorkDir: Context.workDir,
ConfName: config.getConfigFilename(),
Client: config.Filtering.HTTPClient,
Version: version.Version(),
Channel: version.Channel(),
GOARCH: runtime.GOARCH,
GOOS: runtime.GOOS,
GOARM: version.GOARM(),
GOMIPS: version.GOMIPS(),
WorkDir: Context.workDir,
ConfName: config.getConfigFilename(),
ExecPath: execPath,
VersionCheckURL: u.String(),
})
// TODO(e.burkov): This could be made earlier, probably as the option's