forked from multiversx/mx-chain-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99cd142
commit 603ea55
Showing
6 changed files
with
79 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
package disabled | ||
|
||
// ProcessStatusHandler is the disabled implementation for the status handler that keeps track what the node is doing: | ||
// processStatusHandler is the disabled implementation for the status handler that keeps track what the node is doing: | ||
// processing blocks or idle | ||
type ProcessStatusHandler struct { | ||
type processStatusHandler struct { | ||
} | ||
|
||
// NewProcessStatusHandler creates a new instance of type processStatusHandler | ||
func NewProcessStatusHandler() *processStatusHandler { | ||
return &processStatusHandler{} | ||
} | ||
|
||
// SetBusy does nothing | ||
func (psh *ProcessStatusHandler) SetBusy(_ string) {} | ||
func (psh *processStatusHandler) SetBusy(_ string) {} | ||
|
||
// SetIdle does nothing | ||
func (psh *ProcessStatusHandler) SetIdle() {} | ||
func (psh *processStatusHandler) SetIdle() {} | ||
|
||
// IsIdle returns true | ||
func (psh *ProcessStatusHandler) IsIdle() bool { | ||
func (psh *processStatusHandler) IsIdle() bool { | ||
return true | ||
} | ||
|
||
// IsInterfaceNil returns true if there is no value under the interface | ||
func (psh *ProcessStatusHandler) IsInterfaceNil() bool { | ||
func (psh *processStatusHandler) IsInterfaceNil() bool { | ||
return psh == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package disabled | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/ElrondNetwork/elrond-go-core/core/check" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestProcessStatusHandler_MethodsShouldNotPanic(t *testing.T) { | ||
t.Parallel() | ||
|
||
defer func() { | ||
r := recover() | ||
if r != nil { | ||
assert.Fail(t, fmt.Sprintf("should have not panicked: %v", r)) | ||
} | ||
}() | ||
|
||
psh := NewProcessStatusHandler() | ||
assert.False(t, check.IfNil(psh)) | ||
psh.SetBusy("") | ||
psh.SetIdle() | ||
assert.True(t, psh.IsIdle()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters