github.com/olli-ai/jx/v2@v2.0.400-0.20210921045218-14731b4dd448/pkg/cmd/create/create_quickstart_integration_test.go (about) 1 // +build integration 2 3 package create_test 4 5 import ( 6 "io/ioutil" 7 "path/filepath" 8 "testing" 9 10 "github.com/olli-ai/jx/v2/pkg/cmd/create" 11 "github.com/olli-ai/jx/v2/pkg/cmd/importcmd" 12 "github.com/olli-ai/jx/v2/pkg/cmd/testhelpers" 13 14 "github.com/olli-ai/jx/v2/pkg/cmd/opts" 15 "github.com/olli-ai/jx/v2/pkg/gits" 16 "github.com/olli-ai/jx/v2/pkg/helm" 17 "github.com/olli-ai/jx/v2/pkg/quickstarts" 18 "github.com/olli-ai/jx/v2/pkg/tests" 19 "github.com/stretchr/testify/assert" 20 ) 21 22 func TestCreateQuickstartProjects(t *testing.T) { 23 // TODO lets skip this test for now as it often fails with rate limits 24 t.SkipNow() 25 26 originalJxHome, tempJxHome, err := testhelpers.CreateTestJxHomeDir() 27 assert.NoError(t, err) 28 defer func() { 29 err := testhelpers.CleanupTestJxHomeDir(originalJxHome, tempJxHome) 30 assert.NoError(t, err) 31 }() 32 originalKubeCfg, tempKubeCfg, err := testhelpers.CreateTestKubeConfigDir() 33 assert.NoError(t, err) 34 defer func() { 35 err := testhelpers.CleanupTestKubeConfigDir(originalKubeCfg, tempKubeCfg) 36 assert.NoError(t, err) 37 }() 38 39 testDir, err := ioutil.TempDir("", "test-create-quickstart") 40 assert.NoError(t, err) 41 42 appName := "myvets" 43 44 o := &create.CreateQuickstartOptions{ 45 CreateProjectOptions: create.CreateProjectOptions{ 46 ImportOptions: importcmd.ImportOptions{ 47 CommonOptions: &opts.CommonOptions{}, 48 }, 49 }, 50 GitHubOrganisations: []string{"petclinic-gcp"}, 51 Filter: quickstarts.QuickstartFilter{ 52 Text: "petclinic-gcp/spring-petclinic-vets-service", 53 ProjectName: appName, 54 }, 55 } 56 testhelpers.ConfigureTestOptions(o.CommonOptions, gits.NewGitCLI(), helm.NewHelmCLI("helm", helm.V2, testDir, true)) 57 o.Dir = testDir 58 o.OutDir = testDir 59 o.DryRun = true 60 o.DisableMaven = true 61 o.Verbose = true 62 o.IgnoreTeam = true 63 o.Repository = appName 64 65 err = o.Run() 66 assert.NoError(t, err) 67 if err == nil { 68 appDir := filepath.Join(testDir, appName) 69 jenkinsfile := filepath.Join(appDir, "Jenkinsfile") 70 tests.AssertFileExists(t, jenkinsfile) 71 tests.AssertFileExists(t, filepath.Join(appDir, "Dockerfile")) 72 tests.AssertFileExists(t, filepath.Join(appDir, "charts", appName, "Chart.yaml")) 73 tests.AssertFileExists(t, filepath.Join(appDir, "charts", appName, "Makefile")) 74 tests.AssertFileDoesNotExist(t, filepath.Join(appDir, "charts", "spring-petclinic-vets-service", "Chart.yaml")) 75 } 76 }