mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-11-03 20:17:59 +00:00 
			
		
		
		
	Add existence check verification to config/client testcase
This commit is contained in:
		@@ -81,6 +81,21 @@ func TestBackend_ConfigClient(t *testing.T) {
 | 
				
			|||||||
		},
 | 
							},
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						checkFound, exists, err := b.HandleExistenceCheck(&logical.Request{
 | 
				
			||||||
 | 
							Operation: logical.CreateOperation,
 | 
				
			||||||
 | 
							Path:      "config/client",
 | 
				
			||||||
 | 
							Storage:   storage,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							t.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if !checkFound {
 | 
				
			||||||
 | 
							t.Fatal("existence check not found for path 'config/client'")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if exists {
 | 
				
			||||||
 | 
							t.Fatal("existence check should have return 'false' for 'config/client'")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	configClientCreateRequest := &logical.Request{
 | 
						configClientCreateRequest := &logical.Request{
 | 
				
			||||||
		Operation: logical.UpdateOperation,
 | 
							Operation: logical.UpdateOperation,
 | 
				
			||||||
		Path:      "config/client",
 | 
							Path:      "config/client",
 | 
				
			||||||
@@ -92,6 +107,21 @@ func TestBackend_ConfigClient(t *testing.T) {
 | 
				
			|||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						checkFound, exists, err = b.HandleExistenceCheck(&logical.Request{
 | 
				
			||||||
 | 
							Operation: logical.CreateOperation,
 | 
				
			||||||
 | 
							Path:      "config/client",
 | 
				
			||||||
 | 
							Storage:   storage,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							t.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if !checkFound {
 | 
				
			||||||
 | 
							t.Fatal("existence check not found for path 'config/client'")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if !exists {
 | 
				
			||||||
 | 
							t.Fatal("existence check should have return 'true' for 'config/client'")
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clientConfig, err := clientConfigEntry(storage)
 | 
						clientConfig, err := clientConfigEntry(storage)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatal(err)
 | 
							t.Fatal(err)
 | 
				
			||||||
@@ -103,6 +133,9 @@ func TestBackend_ConfigClient(t *testing.T) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func TestBackend_PathConfigCertificate(t *testing.T) {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func TestBackend_PathImage(t *testing.T) {
 | 
					func TestBackend_PathImage(t *testing.T) {
 | 
				
			||||||
	config := logical.TestBackendConfig()
 | 
						config := logical.TestBackendConfig()
 | 
				
			||||||
	storage := &logical.InmemStorage{}
 | 
						storage := &logical.InmemStorage{}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user