Skip to content

Commit

Permalink
generate ssh key per test
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 authored and Jeremy Udit committed Jun 9, 2020
1 parent f0bab3d commit f9315b5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions github/resource_github_repository_deploy_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package github
import (
"context"
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
Expand Down Expand Up @@ -51,6 +53,15 @@ func TestSuppressDeployKeyDiff(t *testing.T) {
}

func TestAccGithubRepositoryDeployKey_basic(t *testing.T) {
testUserEmail := os.Getenv("GITHUB_TEST_USER_EMAIL")
if testUserEmail == "" {
t.Skip("Skipping because `GITHUB_TEST_USER_EMAIL` is not set")
}
cmd := exec.Command("bash", "-c", fmt.Sprintf("ssh-keygen -t rsa -b 4096 -C %s -N '' -f test-fixtures/id_rsa>/dev/null <<< y >/dev/null", testUserEmail))
if err := cmd.Run(); err != nil {
t.Fatal(err)
}

rn := "github_repository_deploy_key.test_repo_deploy_key"
rs := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
repositoryName := fmt.Sprintf("acctest-%s", rs)
Expand Down

0 comments on commit f9315b5

Please sign in to comment.