circleci try 20
This commit is contained in:
parent
7cd274167c
commit
19df71fc5c
@ -68,7 +68,7 @@ func TestTransaction(t *testing.T) {
|
||||
if err := cdb.Exec(ctx, "INSERT INTO itest_scratch (some_int) VALUES (4), (5), (6)"); err != nil {
|
||||
t.Fatal("E0", err)
|
||||
}
|
||||
cdb.BeginTransaction(ctx, func(tx *harmonydb.Transaction) (commit bool) {
|
||||
err := cdb.BeginTransaction(ctx, func(tx *harmonydb.Transaction) (commit bool) {
|
||||
if err := tx.Exec(ctx, "INSERT INTO itest_scratch (some_int) VALUES (7), (8), (9)"); err != nil {
|
||||
t.Fatal("E1", err)
|
||||
}
|
||||
@ -92,6 +92,9 @@ func TestTransaction(t *testing.T) {
|
||||
}
|
||||
return false // rollback
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal("ET", err)
|
||||
}
|
||||
|
||||
var sum2 int
|
||||
// Query() example (yes, QueryRow would be preferred here)
|
||||
@ -102,7 +105,10 @@ func TestTransaction(t *testing.T) {
|
||||
defer q.Close()
|
||||
var rowCt int
|
||||
for q.Next() {
|
||||
q.Scan(&sum2)
|
||||
err := q.Scan(&sum2)
|
||||
if err != nil {
|
||||
t.Fatal("error scanning ", err)
|
||||
}
|
||||
rowCt++
|
||||
}
|
||||
if sum2 != 4+5+6 {
|
||||
|
@ -728,6 +728,15 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
node.Override(new(stmgr.UpgradeSchedule), n.options.upgradeSchedule),
|
||||
|
||||
node.Override(new(harmonydb.ITestID), sharedITestID),
|
||||
node.Override(new(config.HarmonyDB), func() config.HarmonyDB {
|
||||
return config.HarmonyDB{
|
||||
Hosts: []string{envElse("LOTUS_HARMONYDB_HOSTS", "127.0.0.1")},
|
||||
Database: "yugabyte",
|
||||
Username: "yugabyte",
|
||||
Password: "yugabyte",
|
||||
Port: "5433",
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
if m.options.subsystems.Has(SMarkets) {
|
||||
@ -774,8 +783,9 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
require.NoError(n.t, err)
|
||||
|
||||
n.t.Cleanup(func() { _ = stop(context.Background()) })
|
||||
mCopy := m
|
||||
n.t.Cleanup(func() {
|
||||
m.StorageMiner.(*impl.StorageMinerAPI).HarmonyDB.ITestDeleteAll()
|
||||
mCopy.StorageMiner.(*impl.StorageMinerAPI).HarmonyDB.ITestDeleteAll()
|
||||
})
|
||||
|
||||
m.BaseAPI = m.StorageMiner
|
||||
@ -1077,3 +1087,10 @@ func importPreSealMeta(ctx context.Context, meta genesis.Miner, mds dtypes.Metad
|
||||
size := binary.PutUvarint(buf, uint64(maxSectorID))
|
||||
return mds.Put(ctx, datastore.NewKey(pipeline.StorageCounterDSPrefix), buf[:size])
|
||||
}
|
||||
|
||||
func envElse(env, els string) string {
|
||||
if v := os.Getenv(env); v != "" {
|
||||
return v
|
||||
}
|
||||
return els
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ func ensureSchemaExists(connString, schema string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer p.Close(context.Background())
|
||||
defer func() { _ = p.Close(context.Background()) }()
|
||||
|
||||
if len(schema) < 5 || !schemaRE.MatchString(schema) {
|
||||
return errors.New("schema must be of the form " + schemaREString + "\n Got: " + schema)
|
||||
|
@ -65,6 +65,13 @@ func init() {
|
||||
TagKeys: []tag.Key{dbTag},
|
||||
},
|
||||
)
|
||||
prometheus.Register(DBMeasures.Waits)
|
||||
prometheus.Register(DBMeasures.WhichHost)
|
||||
err := prometheus.Register(DBMeasures.Waits)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = prometheus.Register(DBMeasures.WhichHost)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user