repo_description: A cloud-native Go microservices framework with cli tool for productivity.
repo_topics: ai-native ai-native-development cloud-native code-generation framework gateway go golang grpc-gateway microservice microservice-framework microservices microservices-architecture rest-api restful restful-api rpc rpc-framework spec-driven-development web-framework
code: package executors
  
  import (
  	"sync/atomic"
  	"testing"
  	"time"
  
  	"github.com/stretchr/testify/assert"
  )
  
  func TestDelayExecutor(t *testing.T) {
  	var count int32
  	ex := NewDelayExecutor(func() {
  		atomic.AddInt32(&count, 1)
  	}, time.Millisecond*10)
  	for i := 0; i < 100; i++ {
  		ex.Trigger()
  	}
  	time.Sleep(time.Millisecond * 100)
  	assert.Equal(t, int32(1), atomic.LoadInt32(&count))
  }
  