github.com/kubeshop/testkube@v1.17.23/pkg/logs/adapter/minio_v2_test.go (about) 1 package adapter 2 3 import ( 4 "context" 5 "fmt" 6 "strconv" 7 "strings" 8 "testing" 9 "time" 10 11 "github.com/stretchr/testify/assert" 12 13 "github.com/kubeshop/testkube/pkg/logs/events" 14 "github.com/kubeshop/testkube/pkg/utils" 15 ) 16 17 func generateWideLine(sizeKb int) string { 18 b := strings.Builder{} 19 for i := 0; i < sizeKb; i++ { 20 b.WriteString(utils.RandAlphanum(1024)) 21 } 22 23 return b.String() 24 } 25 26 func TestLogsV2Local(t *testing.T) { 27 t.Skip("only local") 28 ctx := context.Background() 29 consumer, _ := NewMinioV2Adapter("127.0.0.1:9000", "minioadmin", "minioadmin", "", "", "test-1", false, false, "", "", "") 30 consumer.WithPath("./") 31 id := "test-bla" 32 err := consumer.Init(ctx, id) 33 assert.NoError(t, err) 34 for i := 0; i < 10; i++ { 35 fmt.Println("sending", i) 36 consumer.Notify(ctx, id, events.Log{Time: time.Now(), 37 Content: fmt.Sprintf("Test %d: %s", i, generateWideLine(200)), 38 Type_: "test", Source: strconv.Itoa(i)}) 39 } 40 err = consumer.Stop(ctx, id) 41 assert.NoError(t, err) 42 }