github.com/mier85/go-sensor@v1.30.1-0.20220920111756-9bf41b3bc7e0/event_internal_test.go (about)

     1  // (c) Copyright IBM Corp. 2021
     2  // (c) Copyright Instana Inc. 2017
     3  
     4  package instana
     5  
     6  import (
     7  	"testing"
     8  	"time"
     9  
    10  	"github.com/instana/testify/assert"
    11  )
    12  
    13  func TestEventBasic(t *testing.T) {
    14  	assert.Equal(t, severity(-1), SeverityChange, "SeverityChange wrong value...")
    15  	assert.Equal(t, severity(5), SeverityWarning, "SeverityWarning wrong value...")
    16  	assert.Equal(t, severity(10), SeverityCritical, "SeverityCritical wrong value...")
    17  }
    18  func TestEventDefault(t *testing.T) {
    19  	SendDefaultServiceEvent("microservice-14c", "These are event details",
    20  		SeverityCritical, 5000*time.Millisecond)
    21  }
    22  
    23  func TestSendServiceEvent(t *testing.T) {
    24  	SendServiceEvent("microservice-14c", "Oh No!", "Pull the cable now!",
    25  		SeverityChange, 1000*time.Millisecond)
    26  }
    27  
    28  func TestSendHostEvent(t *testing.T) {
    29  	SendHostEvent("microservice-14c", "r u listening?",
    30  		SeverityWarning, 500*time.Millisecond)
    31  }