2018-02-05 10:37:59 +00:00
|
|
|
package signal
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNodeCrashEventJSONMarshalling(t *testing.T) {
|
|
|
|
errorMsg := "TestNodeCrashEventJSONMarshallingError"
|
|
|
|
expectedJSON := fmt.Sprintf(`{"error":"%s"}`, errorMsg)
|
|
|
|
nodeCrashEvent := &NodeCrashEvent{
|
2018-05-03 07:35:58 +00:00
|
|
|
Error: errorMsg,
|
2018-02-05 10:37:59 +00:00
|
|
|
}
|
|
|
|
marshalled, err := json.Marshal(nodeCrashEvent)
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, expectedJSON, string(marshalled))
|
|
|
|
}
|