@@ -14,30 +14,20 @@ type Container struct {
1414
1515// Run creates an instance of the Pinecone container type
1616func Run (ctx context.Context , img string , opts ... testcontainers.ContainerCustomizer ) (* Container , error ) {
17- req := testcontainers.ContainerRequest {
18- Image : img ,
19- ExposedPorts : []string {"5080/tcp" },
17+ moduleOpts := []testcontainers.ContainerCustomizer {
18+ testcontainers .WithExposedPorts ("5080/tcp" ),
2019 }
2120
22- genericContainerReq := testcontainers.GenericContainerRequest {
23- ContainerRequest : req ,
24- Started : true ,
25- }
26-
27- for _ , opt := range opts {
28- if err := opt .Customize (& genericContainerReq ); err != nil {
29- return nil , fmt .Errorf ("customize: %w" , err )
30- }
31- }
21+ moduleOpts = append (moduleOpts , opts ... )
3222
33- container , err := testcontainers .GenericContainer (ctx , genericContainerReq )
23+ ctr , err := testcontainers .Run (ctx , img , moduleOpts ... )
3424 var c * Container
35- if container != nil {
36- c = & Container {Container : container }
25+ if ctr != nil {
26+ c = & Container {Container : ctr }
3727 }
3828
3929 if err != nil {
40- return c , fmt .Errorf ("generic container : %w" , err )
30+ return c , fmt .Errorf ("run pinecone : %w" , err )
4131 }
4232
4333 return c , nil
0 commit comments