Add windows to the CI + fix errors when testing on Windows (#1674)

* Add windows to the CI

* Cast syscall.Stdin into an integer

* DataDir -> AppDir in service_windows.go

* Rename mempool-limits package to something non-main

* Close database after re-assigining to it

* Up rpcTimout to 10 seconds
This commit is contained in:
Svarog 2021-04-12 14:53:34 +03:00 committed by GitHub
parent 3f193e9219
commit a8a7e3dd9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 16 additions and 14 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-16.04, macos-10.15 ]
os: [ ubuntu-16.04, macos-10.15, windows-2019 ]
name: Testing on on ${{ matrix.os }}
steps:

View File

@ -11,7 +11,7 @@ import (
// getPassword was adapted from https://gist.github.com/jlinoff/e8e26b4ffa38d379c7f1891fd174a6d0#file-getpassword2-go
func getPassword(prompt string) []byte {
// Get the initial state of the terminal.
initialTermState, e1 := term.GetState(syscall.Stdin)
initialTermState, e1 := term.GetState(int(syscall.Stdin))
if e1 != nil {
panic(e1)
}
@ -22,13 +22,13 @@ func getPassword(prompt string) []byte {
signal.Notify(c, os.Interrupt, os.Kill)
go func() {
<-c
_ = term.Restore(syscall.Stdin, initialTermState)
_ = term.Restore(int(syscall.Stdin), initialTermState)
os.Exit(1)
}()
// Now get the password.
fmt.Print(prompt)
p, err := term.ReadPassword(syscall.Stdin)
p, err := term.ReadPassword(int(syscall.Stdin))
fmt.Println()
if err != nil {
panic(err)

View File

@ -5,14 +5,14 @@
package addressmanager
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/infrastructure/db/database/ldb"
"github.com/kaspanet/kaspad/util/mstime"
"net"
"reflect"
"testing"
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/infrastructure/config"
"github.com/kaspanet/kaspad/infrastructure/db/database/ldb"
"github.com/kaspanet/kaspad/util/mstime"
)
func newAddressManagerForTest(t *testing.T, testName string) (addressManager *AddressManager, teardown func()) {
@ -274,6 +274,7 @@ func TestRestoreAddressManager(t *testing.T) {
if err != nil {
t.Fatalf("Could not create a database: %s", err)
}
defer database.Close()
// Recreate an addressManager with a the previous database
addressManager, err = New(NewConfig(cfg), database)

View File

@ -114,6 +114,6 @@ func (s *Service) logServiceStart() {
var message string
message += fmt.Sprintf("%s version %s\n", s.description.DisplayName, version.Version())
message += fmt.Sprintf("Configuration file: %s\n", s.cfg.ConfigFile)
message += fmt.Sprintf("Data directory: %s\n", s.cfg.DataDir)
message += fmt.Sprintf("Application directory: %s\n", s.cfg.AppDir)
message += fmt.Sprintf("Logs directory: %s\n", s.cfg.LogDir)
}

View File

@ -1,4 +1,4 @@
package main
package mempoollimits
import (
"path/filepath"

View File

@ -1,4 +1,4 @@
package main
package mempoollimits
import (
"fmt"

View File

@ -1,4 +1,4 @@
package main
package mempoollimits
import (
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"

View File

@ -1,4 +1,4 @@
package main
package mempoollimits
import (
"encoding/hex"

View File

@ -1,11 +1,12 @@
package integration
import (
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"
"time"
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"
)
const rpcTimeout = 1 * time.Second
const rpcTimeout = 10 * time.Second
type testRPCClient struct {
*rpcclient.RPCClient