zeekayandHanzo Dev 6acdbad182 ci: canonical pair — hanzo.yml + forge caller
github.com has no runner for hanzo-build-linux-amd64, so a caller under
.github/workflows is a gate that can never be scheduled. This is the ~7-line
caller on the plane that can (git.hanzo.ai git-runner fleet), pinned @v1.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-06 02:29:50 -07:00

ClickHouse-go-mock

A mock library implementing support for clickhouse-go/v2/lib/driver

Install

go get github.com/srikanthccv/ClickHouse-go-mock

Quick Start


package main

import (
	"context"
	"log"

	"github.com/ClickHouse/clickhouse-go/v2"
	cmock "github.com/srikanthccv/ClickHouse-go-mock"
)

type Video struct {
	Name    string `db:"name"`
	Title   string `db:"title"`
	Content string `db:"content"`
}

func fetchVideos(conn clickhouse.Conn) (*Video, error) {
	var video Video
	if _, err := conn.Query(context.TODO(), "SELECT name, title, content FROM videos WHERE name LIKE ?", "%Cocomelon%"); err != nil {
		return nil, err
	}
	return &video, nil
}

func main() {
	mock, err := cmock.NewClickHouseNative(nil)
	if err != nil {
		log.Fatalf("an error '%s' was not expected when opening a stub database connection", err)
	}

	mock.ExpectQuery("SELECT name, title, content FROM videos WHERE name LIKE ?").WithArgs("%Cocomelon%")
	_, err = fetchVideos(mock)
	if err != nil {
		log.Fatalf("an error '%s' was not expected when querying a statement", err)
	}

	if err := mock.ExpectationsWereMet(); err != nil {
		log.Fatalf("there were unfulfilled expectations: %s", err)
	}
}

Documentation

Please see the package documentation at godoc.org.

And tests are the best documentation, see clickconnmock_test.go.

License

The Apache License, Version 2.0 - see LICENSE for more details.

Credits

This library is built on top of clickhouse-go and sqlmock

S
Description
Hanzo datastore-native mock (fork of clickhouse-go-mock) — Datastore API for hanzoai/otel-collector tests
Readme Apache-2.0
55 KiB
Languages
Go 100%