github.com/cilium/cilium@v1.16.2/pkg/api/helpers/delay_simulator_test.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package helpers
     5  
     6  import (
     7  	"testing"
     8  	"time"
     9  
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  type operation int
    14  
    15  const (
    16  	operation1 operation = iota
    17  	operation2
    18  )
    19  
    20  func TestSetDelay(t *testing.T) {
    21  	d := NewDelaySimulator()
    22  	require.NotNil(t, d)
    23  
    24  	d.SetDelay(operation1, time.Second)
    25  	require.Equal(t, time.Second, d.delays[operation1])
    26  	require.Equal(t, time.Duration(0), d.delays[operation2])
    27  }