Merge pull request #5833 from guggero/itest-github-fixes
itest: fix log file upload and flakes
This commit is contained in:
5 files changed
+54
-10
No files matched your search
@@ -286,8 +286,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: logs
|
name: logs-itest-${{ job.id }}
|
||||||
path: lntest/itest/**/*.log
|
path: lntest/itest/**/*.log
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
@@ -325,8 +326,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
if: ${{ failure() }}
|
||||||
with:
|
with:
|
||||||
name: logs
|
name: logs-itest-windows
|
||||||
path: lntest/itest/**/*.log
|
path: lntest/itest/**/*.log
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
|
|||||||
@@ -340,6 +340,9 @@ you.
|
|||||||
|
|
||||||
* [Replace reference to protobuf library with OSV](https://github.com/lightningnetwork/lnd/pull/5759)
|
* [Replace reference to protobuf library with OSV](https://github.com/lightningnetwork/lnd/pull/5759)
|
||||||
|
|
||||||
|
* [Only upload itest logs on failure, fix more
|
||||||
|
flakes](https://github.com/lightningnetwork/lnd/pull/5833).
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
* [Ensure single writer for legacy
|
* [Ensure single writer for legacy
|
||||||
|
|||||||
@@ -451,11 +451,15 @@ func wsTestCaseBiDirectionalSubscription(ht *harnessTest,
|
|||||||
|
|
||||||
// We want to read messages over and over again. We just accept any
|
// We want to read messages over and over again. We just accept any
|
||||||
// channels that are opened.
|
// channels that are opened.
|
||||||
|
defer close(done)
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
_, msg, err := conn.ReadMessage()
|
_, msg, err := conn.ReadMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
select {
|
||||||
|
case errChan <- err:
|
||||||
|
case <-done:
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +468,11 @@ func wsTestCaseBiDirectionalSubscription(ht *harnessTest,
|
|||||||
// get rid of here.
|
// get rid of here.
|
||||||
msgStr := string(msg)
|
msgStr := string(msg)
|
||||||
if !strings.Contains(msgStr, "\"result\":") {
|
if !strings.Contains(msgStr, "\"result\":") {
|
||||||
errChan <- fmt.Errorf("invalid msg: %s", msgStr)
|
select {
|
||||||
|
case errChan <- fmt.Errorf("invalid msg: %s",
|
||||||
|
msgStr):
|
||||||
|
case <-done:
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
msgStr = resultPattern.ReplaceAllString(msgStr, "${1}")
|
msgStr = resultPattern.ReplaceAllString(msgStr, "${1}")
|
||||||
@@ -474,7 +482,10 @@ func wsTestCaseBiDirectionalSubscription(ht *harnessTest,
|
|||||||
protoMsg := &lnrpc.ChannelAcceptRequest{}
|
protoMsg := &lnrpc.ChannelAcceptRequest{}
|
||||||
err = jsonpb.UnmarshalString(msgStr, protoMsg)
|
err = jsonpb.UnmarshalString(msgStr, protoMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
select {
|
||||||
|
case errChan <- err:
|
||||||
|
case <-done:
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,14 +496,20 @@ func wsTestCaseBiDirectionalSubscription(ht *harnessTest,
|
|||||||
}
|
}
|
||||||
resMsg, err := jsonMarshaler.MarshalToString(res)
|
resMsg, err := jsonMarshaler.MarshalToString(res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
select {
|
||||||
|
case errChan <- err:
|
||||||
|
case <-done:
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = conn.WriteMessage(
|
err = conn.WriteMessage(
|
||||||
websocket.TextMessage, []byte(resMsg),
|
websocket.TextMessage, []byte(resMsg),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errChan <- err
|
select {
|
||||||
|
case errChan <- err:
|
||||||
|
case <-done:
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,7 +548,6 @@ func wsTestCaseBiDirectionalSubscription(ht *harnessTest,
|
|||||||
ht.t.Fatalf("Timeout before message was received")
|
ht.t.Fatalf("Timeout before message was received")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(done)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func wsTestPingPongTimeout(ht *harnessTest, net *lntest.NetworkHarness) {
|
func wsTestPingPongTimeout(ht *harnessTest, net *lntest.NetworkHarness) {
|
||||||
|
|||||||
@@ -403,7 +403,9 @@ func middlewareMandatoryTest(t *testing.T, node *lntest.HarnessNode,
|
|||||||
// test case. So we need to do the wait and client setup manually here.
|
// test case. So we need to do the wait and client setup manually here.
|
||||||
conn, err := node.ConnectRPC(true)
|
conn, err := node.ConnectRPC(true)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
err = node.WaitUntilStarted(conn, defaultTimeout)
|
err = node.WaitUntilStateReached(
|
||||||
|
conn, defaultTimeout, lnrpc.WalletState_RPC_ACTIVE,
|
||||||
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
node.LightningClient = lnrpc.NewLightningClient(conn)
|
node.LightningClient = lnrpc.NewLightningClient(conn)
|
||||||
|
|
||||||
|
|||||||
+22
-1
@@ -887,6 +887,27 @@ func (hn *HarnessNode) start(lndBinary string, lndError chan<- error,
|
|||||||
func (hn *HarnessNode) WaitUntilStarted(conn grpc.ClientConnInterface,
|
func (hn *HarnessNode) WaitUntilStarted(conn grpc.ClientConnInterface,
|
||||||
timeout time.Duration) error {
|
timeout time.Duration) error {
|
||||||
|
|
||||||
|
return hn.waitForState(conn, timeout, func(s lnrpc.WalletState) bool {
|
||||||
|
return s != lnrpc.WalletState_WAITING_TO_START
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WaitUntilStateReached waits until the given wallet state (or one of the
|
||||||
|
// states following it) has been reached.
|
||||||
|
func (hn *HarnessNode) WaitUntilStateReached(conn grpc.ClientConnInterface,
|
||||||
|
timeout time.Duration, desiredState lnrpc.WalletState) error {
|
||||||
|
|
||||||
|
return hn.waitForState(conn, timeout, func(s lnrpc.WalletState) bool {
|
||||||
|
return s >= desiredState
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// waitForState waits until the current node state fulfills the given
|
||||||
|
// predicate.
|
||||||
|
func (hn *HarnessNode) waitForState(conn grpc.ClientConnInterface,
|
||||||
|
timeout time.Duration,
|
||||||
|
predicate func(state lnrpc.WalletState) bool) error {
|
||||||
|
|
||||||
stateClient := lnrpc.NewStateClient(conn)
|
stateClient := lnrpc.NewStateClient(conn)
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
@@ -908,7 +929,7 @@ func (hn *HarnessNode) WaitUntilStarted(conn grpc.ClientConnInterface,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.State != lnrpc.WalletState_WAITING_TO_START {
|
if predicate(resp.State) {
|
||||||
close(started)
|
close(started)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user