Merge: Win travis build

* commit '6503bab1aaa27ff43175d069413630a420093be0':
  *: added cross-env to npm scripts
  run npm build on windows
  *: added more logging
  -: fix autohosts tests on Windows
  -: fix qlog test on Windows
  *: fix nvs script
  *: travis - use nvs on Windows
  *: travis-win -- try nvm
  *(global): travis: choco install nodejs
  +(global): windows travis build
This commit is contained in:
Andrey Meshkov
2020-04-15 16:13:24 +03:00
11 changed files with 217 additions and 67 deletions

View File

@@ -71,6 +71,8 @@ type User struct {
// InitAuth - create a global object
func InitAuth(dbFilename string, users []User, sessionTTL uint32) *Auth {
log.Info("Initializing auth module: %s", dbFilename)
a := Auth{}
a.sessionTTL = sessionTTL
a.sessions = make(map[string]*session)
@@ -83,7 +85,7 @@ func InitAuth(dbFilename string, users []User, sessionTTL uint32) *Auth {
}
a.loadSessions()
a.users = users
log.Debug("Auth: initialized. users:%d sessions:%d", len(a.users), len(a.sessions))
log.Info("Auth: initialized. users:%d sessions:%d", len(a.users), len(a.sessions))
return &a
}

View File

@@ -43,10 +43,10 @@ const (
// Update-related variables
var (
versionString string
updateChannel string
versionCheckURL string
ARMVersion string
versionString = "dev"
updateChannel = "none"
versionCheckURL = ""
ARMVersion = ""
)
const versionCheckPeriod = time.Hour * 8
@@ -155,11 +155,11 @@ func run(args options) {
configureLogger(args)
// print the first message after logger is configured
msg := "AdGuard Home, version %s, channel %s\n, arch %s %s"
msg := "AdGuard Home, version %s, channel %s, arch %s %s"
if ARMVersion != "" {
msg = msg + " v" + ARMVersion
}
log.Printf(msg, versionString, updateChannel, runtime.GOOS, runtime.GOARCH, ARMVersion)
log.Printf(msg, versionString, updateChannel, runtime.GOOS, runtime.GOARCH)
log.Debug("Current working directory is %s", Context.workDir)
if args.runningAsService {
log.Info("AdGuard Home is running as a service")
@@ -169,6 +169,7 @@ func run(args options) {
Context.firstRun = detectFirstRun()
if Context.firstRun {
log.Info("This is the first time AdGuard Home is launched")
requireAdminRights()
}
@@ -197,6 +198,7 @@ func run(args options) {
err = parseConfig()
if err != nil {
log.Error("Failed to parse configuration, exiting")
os.Exit(1)
}
@@ -211,6 +213,7 @@ func run(args options) {
config.DHCP.ConfigModified = onConfigModified
Context.dhcpServer = dhcpd.Create(config.DHCP)
if Context.dhcpServer == nil {
log.Error("Failed to initialize DHCP server, exiting")
os.Exit(1)
}
Context.autoHosts.Init("")

View File

@@ -107,14 +107,14 @@ schema_version: 5
// . Wait until the filters are downloaded
// . Stop and cleanup
func TestHome(t *testing.T) {
// Reinit context
// Init new context
Context = homeContext{}
dir := prepareTestDir()
defer func() { _ = os.RemoveAll(dir) }()
_ = os.MkdirAll(filepath.Join(Context.getDataDir(), filterDir), 0755)
fn := filepath.Join(dir, "AdGuardHome.yaml")
// Prepare the test config
assert.True(t, ioutil.WriteFile(fn, []byte(yamlConf), 0644) == nil)
fn, _ = filepath.Abs(fn)
@@ -135,11 +135,11 @@ func TestHome(t *testing.T) {
time.Sleep(100 * time.Millisecond)
}
assert.Truef(t, err == nil, "%s", err)
assert.Equal(t, 200, resp.StatusCode)
assert.Equal(t, http.StatusOK, resp.StatusCode)
resp, err = h.Get("http://127.0.0.1:3000/control/status")
assert.Truef(t, err == nil, "%s", err)
assert.Equal(t, 200, resp.StatusCode)
assert.Equal(t, http.StatusOK, resp.StatusCode)
// test DNS over UDP
r := upstream.NewResolver("127.0.0.1:5354", 3*time.Second)

View File

@@ -42,6 +42,8 @@ type Web struct {
// CreateWeb - create module
func CreateWeb(conf *WebConfig) *Web {
log.Info("Initialize web module")
w := Web{}
w.conf = conf