File tree Expand file tree Collapse file tree
testing/platform/clickhousetesting Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,11 +64,17 @@ func (s *Server) NewDatabase(t TestingT) *Database {
6464 }
6565}
6666
67- func CreateServer (pool * docker.Pool ) * Server {
67+ func CreateServer (pool * docker.Pool , opts ... ServerOption ) * Server {
68+
69+ serverOptions := ServerOptions {}
70+ for _ , opt := range append (defaultOptions , opts ... ) {
71+ opt (& serverOptions )
72+ }
73+
6874 resource := pool .Run (docker.Configuration {
6975 RunOptions : & dockertest.RunOptions {
7076 Repository : "clickhouse/clickhouse-server" ,
71- Tag : "25.2-alpine" ,
77+ Tag : serverOptions . Version ,
7278 Env : []string {"CLICKHOUSE_PASSWORD=password" },
7379 },
7480 CheckFn : func (ctx context.Context , resource * dockertest.Resource ) error {
@@ -103,3 +109,19 @@ type Database struct {
103109func (d * Database ) ConnString () string {
104110 return d .url
105111}
112+
113+ type ServerOptions struct {
114+ Version string
115+ }
116+
117+ type ServerOption func (options * ServerOptions )
118+
119+ func WithVersion (version string ) ServerOption {
120+ return func (options * ServerOptions ) {
121+ options .Version = version
122+ }
123+ }
124+
125+ var defaultOptions = []ServerOption {
126+ WithVersion ("25.2-alpine" ),
127+ }
You can’t perform that action at this time.
0 commit comments