mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 10:37:56 +00:00 
			
		
		
		
	 e0216cab5b
			
		
	
	e0216cab5b
	
	
	
		
			
			* Add HCP engine token logic * Update documentation * Fix content check * Add changelog entry * Update changelog/23897.txt Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com> * Update api/client.go Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com> * Add error when HCP commands failed to be initialize * Add tests for initHCPcommand function * Update lib dependency * Update website/content/docs/commands/hcp.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/commands/hcp.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/commands/hcp.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/commands/hcp.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/commands/hcp.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/commands/hcp.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/commands/hcp.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Fix docs nav data * Improve docs sections * Update hcp lib dependency * Fix content formatting * Update lib dependency * Fix HCPtokenhelper problem * Fix HCPtokenhelper problem * Remove HCP env variables * Remove hcp helper token * Add error treatment for no valid credential source * Update website/content/docs/commands/hcp/index.mdx Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com> * Update website/content/docs/commands/hcp/disconnect.mdx Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com> * Update website/content/docs/commands/hcp/connect.mdx Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com> * Update website/content/docs/commands/hcp/disconnect.mdx Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com> * Update website/content/docs/commands/hcp/index.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Update website/content/docs/commands/hcp/connect.mdx Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * Modify hcp tests --------- Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com> Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com> Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>
		
			
				
	
	
		
			46 lines
		
	
	
		
			1011 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1011 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) HashiCorp, Inc.
 | |
| // SPDX-License-Identifier: BUSL-1.1
 | |
| 
 | |
| package command
 | |
| 
 | |
| import (
 | |
| 	"testing"
 | |
| 
 | |
| 	"github.com/hashicorp/cli"
 | |
| 	"github.com/stretchr/testify/require"
 | |
| )
 | |
| 
 | |
| func Test_Commands_HCPInit(t *testing.T) {
 | |
| 	tests := map[string]struct {
 | |
| 		expectError      bool
 | |
| 		expectedErrorMsg string
 | |
| 	}{
 | |
| 		"initialize with success": {
 | |
| 			expectError: false,
 | |
| 		},
 | |
| 		"initialize with error: existing commands conflict with init commands": {
 | |
| 			expectError:      true,
 | |
| 			expectedErrorMsg: "Failed to initialize HCP commands.",
 | |
| 		},
 | |
| 	}
 | |
| 
 | |
| 	for n, tst := range tests {
 | |
| 		t.Run(n, func(t *testing.T) {
 | |
| 			t.Parallel()
 | |
| 
 | |
| 			mockUi := cli.NewMockUi()
 | |
| 			commands := initCommands(mockUi, nil, nil)
 | |
| 			if tst.expectError {
 | |
| 				initHCPCommands(mockUi, commands)
 | |
| 				errMsg := mockUi.ErrorWriter.String()
 | |
| 				require.NotEmpty(t, errMsg)
 | |
| 				require.Contains(t, errMsg, tst.expectedErrorMsg)
 | |
| 			} else {
 | |
| 				errMsg := mockUi.ErrorWriter.String()
 | |
| 				require.Empty(t, errMsg)
 | |
| 				require.NotEmpty(t, commands)
 | |
| 			}
 | |
| 		})
 | |
| 	}
 | |
| }
 |