mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	 9f5babf584
			
		
	
	9f5babf584
	
	
	
		
			
			* core: Record the time a node became active * Update vault/core.go Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com> * Add omitempty field * Update vendor * Added CL entry and fixed test * Fix test * Fix command package tests Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
		
			
				
	
	
		
			39 lines
		
	
	
		
			964 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			964 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package http
 | |
| 
 | |
| import (
 | |
| 	"encoding/json"
 | |
| 	"net/http"
 | |
| 	"reflect"
 | |
| 	"testing"
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/hashicorp/vault/vault"
 | |
| )
 | |
| 
 | |
| func TestSysLeader_get(t *testing.T) {
 | |
| 	core, _, _ := vault.TestCoreUnsealed(t)
 | |
| 	ln, addr := TestServer(t, core)
 | |
| 	defer ln.Close()
 | |
| 
 | |
| 	resp, err := http.Get(addr + "/v1/sys/leader")
 | |
| 	if err != nil {
 | |
| 		t.Fatalf("err: %s", err)
 | |
| 	}
 | |
| 
 | |
| 	var actual map[string]interface{}
 | |
| 	expected := map[string]interface{}{
 | |
| 		"ha_enabled":                          false,
 | |
| 		"is_self":                             false,
 | |
| 		"leader_address":                      "",
 | |
| 		"leader_cluster_address":              "",
 | |
| 		"performance_standby":                 false,
 | |
| 		"performance_standby_last_remote_wal": json.Number("0"),
 | |
| 		"active_time":                         time.Time{}.UTC().Format(time.RFC3339),
 | |
| 	}
 | |
| 	testResponseStatus(t, resp, 200)
 | |
| 	testResponseBody(t, resp, &actual)
 | |
| 	if !reflect.DeepEqual(actual, expected) {
 | |
| 		t.Fatalf("bad: %#v \n%#v", actual, expected)
 | |
| 	}
 | |
| }
 |