github.com/instana/go-sensor@v1.62.2-0.20240520081010-4919868049e1/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/stretchr/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  	defer ShutdownSensor()
    22  }
    23  
    24  func TestSendServiceEvent(t *testing.T) {
    25  	SendServiceEvent("microservice-14c", "Oh No!", "Pull the cable now!",
    26  		SeverityChange, 1000*time.Millisecond)
    27  	defer ShutdownSensor()
    28  }
    29  
    30  func TestSendHostEvent(t *testing.T) {
    31  	SendHostEvent("microservice-14c", "r u listening?",
    32  		SeverityWarning, 500*time.Millisecond)
    33  	defer ShutdownSensor()
    34  }