github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/conf/postgres/postgres_test.go (about)

     1  package postgres_test
     2  
     3  import (
     4  	"testing"
     5  	// . "github.com/onsi/gomega"
     6  )
     7  
     8  func DISABLED_TestPostgres(t *testing.T) {
     9  	/*
    10  		var (
    11  			pg        = postgrestestutil.Endpoint
    12  			masterURL = []byte(postgrestestutil.Endpoint.Master.String())
    13  			slaveURL  = []byte(postgrestestutil.Endpoint.Slave.String())
    14  		)
    15  
    16  		NewWithT(t).Expect(pg.Master.UnmarshalText(masterURL)).To(BeNil())
    17  		NewWithT(t).Expect(pg.Slave.UnmarshalText(slaveURL)).To(BeNil())
    18  
    19  		pg.SetDefault()
    20  		pg.Init()
    21  
    22  		{
    23  			row, err := pg.QueryContext(context.Background(), "SELECT 1")
    24  			NewWithT(t).Expect(err).To(BeNil())
    25  			_ = row.Close()
    26  		}
    27  
    28  		{
    29  			row, err := postgres.SwitchSlave(pg).QueryContext(context.Background(), "SELECT 1")
    30  			NewWithT(t).Expect(err).To(BeNil())
    31  			_ = row.Close()
    32  		}
    33  
    34  		NewWithT(t).Expect(pg.UseSlave()).NotTo(Equal(pg.DB))
    35  		NewWithT(t).Expect(pg.LivenessCheck()).To(
    36  			Equal(map[string]string{
    37  				pg.Master.Host(): "ok",
    38  				pg.Slave.Host():  "ok",
    39  			}),
    40  		)
    41  	*/
    42  }