github.com/hoveychen/kafka-go@v0.4.42/createacl_test.go (about) 1 package kafka 2 3 import ( 4 "context" 5 "testing" 6 7 ktesting "github.com/hoveychen/kafka-go/testing" 8 ) 9 10 func TestClientCreateACLs(t *testing.T) { 11 if !ktesting.KafkaIsAtLeast("2.0.1") { 12 return 13 } 14 15 client, shutdown := newLocalClient() 16 defer shutdown() 17 18 res, err := client.CreateACLs(context.Background(), &CreateACLsRequest{ 19 ACLs: []ACLEntry{ 20 { 21 Principal: "User:alice", 22 PermissionType: ACLPermissionTypeAllow, 23 Operation: ACLOperationTypeRead, 24 ResourceType: ResourceTypeTopic, 25 ResourcePatternType: PatternTypeLiteral, 26 ResourceName: "fake-topic-for-alice", 27 Host: "*", 28 }, 29 { 30 Principal: "User:bob", 31 PermissionType: ACLPermissionTypeAllow, 32 Operation: ACLOperationTypeRead, 33 ResourceType: ResourceTypeGroup, 34 ResourcePatternType: PatternTypeLiteral, 35 ResourceName: "fake-group-for-bob", 36 Host: "*", 37 }, 38 }, 39 }) 40 if err != nil { 41 t.Fatal(err) 42 } 43 44 for _, err := range res.Errors { 45 if err != nil { 46 t.Error(err) 47 } 48 } 49 }