-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added private repositories argocd_repository acceptance tests, fixed …
…sensitive repository data permadiffs, removed 1.4.x support (#24) * added private repositories acceptance tests * repository: add ForceNew flag to repo attribute * fix sensitive data (passwords, keys) not being returned by ArgoCD API * removed 1.4.x support
- Loading branch information
Showing
18 changed files
with
315 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,27 +7,54 @@ import ( | |
) | ||
|
||
func TestAccArgoCDRepository(t *testing.T) { | ||
repoUrl := "[email protected]:project.git" | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
//{ | ||
// Config: testAccArgoCDRepositorySimple(), | ||
// Check: resource.ComposeTestCheckFunc( | ||
// resource.TestCheckResourceAttr( | ||
// "argocd_repository.simple", | ||
// "connection_state_status", | ||
// "Successful", | ||
// ), | ||
// ), | ||
//}, | ||
//{ | ||
// Config: testAccArgoCDRepositoryHelm(), | ||
// Check: resource.ComposeTestCheckFunc( | ||
// resource.TestCheckResourceAttr( | ||
// "argocd_repository.helm", | ||
// "connection_state_status", | ||
// "Successful", | ||
// ), | ||
// ), | ||
//}, | ||
//{ | ||
// Config: testAccArgoCDRepositoryPublicUsageInApplication(acctest.RandString(10)), | ||
// Check: resource.ComposeTestCheckFunc( | ||
// resource.TestCheckResourceAttrSet( | ||
// "argocd_application.public", | ||
// "metadata.0.uid", | ||
// ), | ||
// ), | ||
//}, | ||
{ | ||
Config: testAccArgoCDRepositorySimple(), | ||
Config: testAccArgoCDRepositoryPrivateGitSSH(repoUrl), | ||
//ExpectNonEmptyPlan: true, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr( | ||
"argocd_repository.simple", | ||
"argocd_repository.private", | ||
"connection_state_status", | ||
"Successful", | ||
), | ||
), | ||
}, | ||
{ | ||
Config: testAccArgoCDRepositoryHelm(), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr( | ||
"argocd_repository.helm", | ||
"connection_state_status", | ||
"Successful", | ||
"argocd_repository.private", | ||
"inherited_creds", | ||
"false", | ||
), | ||
), | ||
}, | ||
|
@@ -52,3 +79,35 @@ resource "argocd_repository" "helm" { | |
} | ||
`) | ||
} | ||
|
||
func testAccArgoCDRepositoryPublicUsageInApplication(name string) string { | ||
return testAccArgoCDRepositorySimple() + fmt.Sprintf(` | ||
resource "argocd_application" "public" { | ||
metadata { | ||
name = "%s" | ||
namespace = "argocd" | ||
} | ||
spec { | ||
source { | ||
repo_url = argocd_repository.simple.repo | ||
path = "examples/helloWorld" | ||
} | ||
destination { | ||
server = "https://kubernetes.default.svc" | ||
namespace = "default" | ||
} | ||
} | ||
} | ||
`, name) | ||
} | ||
|
||
func testAccArgoCDRepositoryPrivateGitSSH(repoUrl string) string { | ||
return fmt.Sprintf(` | ||
resource "argocd_repository" "private" { | ||
repo = "%s" | ||
type = "git" | ||
insecure = true | ||
ssh_private_key = "-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW\nQyNTUxOQAAACCGe6Vx0gbKqKCI0wIplfgK5JBjCDO3bhtU3sZfLoeUZgAAAJB9cNEifXDR\nIgAAAAtzc2gtZWQyNTUxOQAAACCGe6Vx0gbKqKCI0wIplfgK5JBjCDO3bhtU3sZfLoeUZg\nAAAEAJeUrObjoTbGO1Sq4TXHl/j4RJ5aKMC1OemWuHmLK7XYZ7pXHSBsqooIjTAimV+Ark\nkGMIM7duG1Texl8uh5RmAAAAC3Rlc3RAYXJnb2NkAQI=\n-----END OPENSSH PRIVATE KEY-----" | ||
} | ||
`, repoUrl) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.