mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-10-14 00:59:33 +00:00
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:
parent
3f193e9219
commit
a8a7e3dd9b
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-16.04, macos-10.15 ]
|
os: [ ubuntu-16.04, macos-10.15, windows-2019 ]
|
||||||
name: Testing on on ${{ matrix.os }}
|
name: Testing on on ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
// getPassword was adapted from https://gist.github.com/jlinoff/e8e26b4ffa38d379c7f1891fd174a6d0#file-getpassword2-go
|
// getPassword was adapted from https://gist.github.com/jlinoff/e8e26b4ffa38d379c7f1891fd174a6d0#file-getpassword2-go
|
||||||
func getPassword(prompt string) []byte {
|
func getPassword(prompt string) []byte {
|
||||||
// Get the initial state of the terminal.
|
// Get the initial state of the terminal.
|
||||||
initialTermState, e1 := term.GetState(syscall.Stdin)
|
initialTermState, e1 := term.GetState(int(syscall.Stdin))
|
||||||
if e1 != nil {
|
if e1 != nil {
|
||||||
panic(e1)
|
panic(e1)
|
||||||
}
|
}
|
||||||
@ -22,13 +22,13 @@ func getPassword(prompt string) []byte {
|
|||||||
signal.Notify(c, os.Interrupt, os.Kill)
|
signal.Notify(c, os.Interrupt, os.Kill)
|
||||||
go func() {
|
go func() {
|
||||||
<-c
|
<-c
|
||||||
_ = term.Restore(syscall.Stdin, initialTermState)
|
_ = term.Restore(int(syscall.Stdin), initialTermState)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Now get the password.
|
// Now get the password.
|
||||||
fmt.Print(prompt)
|
fmt.Print(prompt)
|
||||||
p, err := term.ReadPassword(syscall.Stdin)
|
p, err := term.ReadPassword(int(syscall.Stdin))
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
package addressmanager
|
package addressmanager
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kaspanet/kaspad/app/appmessage"
|
|
||||||
"github.com/kaspanet/kaspad/infrastructure/db/database/ldb"
|
|
||||||
"github.com/kaspanet/kaspad/util/mstime"
|
|
||||||
"net"
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/kaspanet/kaspad/app/appmessage"
|
||||||
"github.com/kaspanet/kaspad/infrastructure/config"
|
"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()) {
|
func newAddressManagerForTest(t *testing.T, testName string) (addressManager *AddressManager, teardown func()) {
|
||||||
@ -274,6 +274,7 @@ func TestRestoreAddressManager(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Could not create a database: %s", err)
|
t.Fatalf("Could not create a database: %s", err)
|
||||||
}
|
}
|
||||||
|
defer database.Close()
|
||||||
|
|
||||||
// Recreate an addressManager with a the previous database
|
// Recreate an addressManager with a the previous database
|
||||||
addressManager, err = New(NewConfig(cfg), database)
|
addressManager, err = New(NewConfig(cfg), database)
|
||||||
|
@ -114,6 +114,6 @@ func (s *Service) logServiceStart() {
|
|||||||
var message string
|
var message string
|
||||||
message += fmt.Sprintf("%s version %s\n", s.description.DisplayName, version.Version())
|
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("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)
|
message += fmt.Sprintf("Logs directory: %s\n", s.cfg.LogDir)
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package mempoollimits
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package mempoollimits
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package mempoollimits
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"
|
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package mempoollimits
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"
|
||||||
)
|
)
|
||||||
|
|
||||||
const rpcTimeout = 1 * time.Second
|
const rpcTimeout = 10 * time.Second
|
||||||
|
|
||||||
type testRPCClient struct {
|
type testRPCClient struct {
|
||||||
*rpcclient.RPCClient
|
*rpcclient.RPCClient
|
||||||
|
Loading…
x
Reference in New Issue
Block a user