Files
zeekay b36a8788a5 feat: rebrand SigNoz → Hanzo O11y
Full rebrand of the SigNoz observability platform:
- Go module: github.com/SigNoz/signoz → github.com/hanzoai/o11y
- Frontend: @signozhq/* → @hanzo/o11y-*, posthog-js → @hanzo/insights
- Docker: signoz/* → ghcr.io/hanzoai/o11y*
- ClickHouse → Hanzo Datastore (hanzoai/datastore)
- Env vars: SIGNOZ_* → HANZO_*
- DB tables: signoz_* → o11y_*
- All branding, URLs, docs updated
- 2172 files changed
2026-03-12 02:10:29 -07:00

51 lines
1.7 KiB
Go

package sqlmigrator
import (
"context"
"database/sql/driver"
"testing"
"time"
"github.com/DATA-DOG/go-sqlmock"
"github.com/hanzoai/o11y/pkg/factory"
"github.com/hanzoai/o11y/pkg/instrumentation/instrumentationtest"
"github.com/hanzoai/o11y/pkg/sqlmigration"
"github.com/hanzoai/o11y/pkg/sqlmigration/sqlmigrationtest"
"github.com/hanzoai/o11y/pkg/sqlstore"
"github.com/hanzoai/o11y/pkg/sqlstore/sqlstoretest"
"github.com/stretchr/testify/require"
)
func TestMigratorWithSqliteAndNoopMigration(t *testing.T) {
ctx := context.Background()
sqlstoreConfig := sqlstore.Config{
Provider: "sqlite",
}
migrationConfig := Config{
Lock: Lock{
Timeout: 10 * time.Second,
Interval: 1 * time.Second,
},
}
providerSettings := instrumentationtest.New().ToProviderSettings()
sqlstore := sqlstoretest.New(sqlstoreConfig, sqlmock.QueryMatcherRegexp)
migrator := New(
ctx,
providerSettings,
sqlstore,
sqlmigration.MustNew(ctx, providerSettings, sqlmigration.Config{}, factory.MustNewNamedMap(sqlmigrationtest.NoopMigrationFactory())),
migrationConfig,
)
sqlstore.Mock().ExpectExec("CREATE TABLE IF NOT EXISTS migration (.+)").WillReturnResult(driver.ResultNoRows)
sqlstore.Mock().ExpectExec("CREATE TABLE IF NOT EXISTS migration_lock (.+)").WillReturnResult(driver.ResultNoRows)
sqlstore.Mock().ExpectQuery("INSERT INTO migration_lock (.+)").WillReturnRows(sqlstore.Mock().NewRows([]string{"id"}).AddRow(1))
sqlstore.Mock().ExpectQuery("(.+) FROM migration").WillReturnRows(sqlstore.Mock().NewRows([]string{"id"}).AddRow(1))
sqlstore.Mock().ExpectQuery("INSERT INTO migration (.+)").WillReturnRows(sqlstore.Mock().NewRows([]string{"id", "migrated_at"}).AddRow(1, time.Now()))
err := migrator.Migrate(ctx)
require.NoError(t, err)
}