Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for serverReachable (0.13 sec)

  1. staging/src/k8s.io/apiserver/pkg/storage/etcd3/preflight/checks.go

    	"net"
    	"net/url"
    	"time"
    )
    
    const connectionTimeout = 1 * time.Second
    
    // EtcdConnection holds the Etcd server list
    type EtcdConnection struct {
    	ServerList []string
    }
    
    func (EtcdConnection) serverReachable(connURL *url.URL) bool {
    	scheme := connURL.Scheme
    	if scheme == "http" || scheme == "https" || scheme == "tcp" {
    		scheme = "tcp"
    	}
    	if conn, err := net.DialTimeout(scheme, connURL.Host, connectionTimeout); err == nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 20 10:50:48 UTC 2018
    - 1.8K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/storage/etcd3/preflight/checks_test.go

    	_, err := parseServerURI("-invalid uri$@#%")
    	if err == nil {
    		t.Fatal("expected bad uri to raise parse error")
    	}
    }
    
    func TestEtcdConnection(t *testing.T) {
    	etcd := new(EtcdConnection)
    
    	result := etcd.serverReachable(&url.URL{Host: "-not a real network address-", Scheme: "tcp"})
    	if result {
    		t.Fatal("checkConnection should not have succeeded")
    	}
    }
    
    func TestCheckEtcdServersEmpty(t *testing.T) {
    	etcd := new(EtcdConnection)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Aug 01 21:37:52 UTC 2017
    - 2.7K bytes
    - Viewed (0)
Back to top