diff --git a/.github/workflows/pythonTests.yml b/.github/workflows/pythonTests.yml index fd937028b..d9aed44fa 100644 --- a/.github/workflows/pythonTests.yml +++ b/.github/workflows/pythonTests.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - suite: [ pip, pipenv, poetry ] + suite: [ pip, pipenv ] os: [ ubuntu, windows, macos ] runs-on: ${{ matrix.os }}-latest steps: @@ -35,9 +35,6 @@ jobs: - name: Setup Pipenv if: ${{ matrix.suite == 'pipenv' }} run: python -m pip install pipenv - - name: Setup Poetry - if: ${{ matrix.suite == 'poetry' }} - run: python -m pip install poetry - name: Checkout code uses: actions/checkout@v3 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9bd3949d..30d6a1ede 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,7 +104,6 @@ The available test types are: | `-test.go` | Go tests | | `-test.pip` | Pip tests | | `-test.pipenv` | Pipenv tests | -| `-test.poetry` | Poetry tests | | `-test.nuget` | Nuget tests | | `-test.plugins` | Plugins tests | | `-test.distribution` | Distribution tests | diff --git a/main_test.go b/main_test.go index 41805010a..f9d4fb07b 100644 --- a/main_test.go +++ b/main_test.go @@ -55,7 +55,7 @@ func setupIntegrationTests() { if (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject { InitArtifactoryTests() } - if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry { + if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv { InitBuildToolsTests() } if *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan { @@ -85,7 +85,7 @@ func tearDownIntegrationTests() { if (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestArtifactoryProject { CleanArtifactoryTests() } - if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestPoetry || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan { + if *tests.TestNpm || *tests.TestGradle || *tests.TestMaven || *tests.TestGo || *tests.TestNuget || *tests.TestPip || *tests.TestPipenv || *tests.TestDocker || *tests.TestPodman || *tests.TestDockerScan { CleanBuildToolsTests() } if *tests.TestDistribution { diff --git a/poetry_test.go b/poetry_test.go deleted file mode 100644 index 3188ad34d..000000000 --- a/poetry_test.go +++ /dev/null @@ -1,129 +0,0 @@ -package main - -import ( - biutils "github.com/jfrog/build-info-go/utils" - "os" - "path/filepath" - "strconv" - "testing" - - clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests" - - buildinfo "github.com/jfrog/build-info-go/entities" - "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" - "github.com/jfrog/jfrog-cli/inttestutils" - "github.com/jfrog/jfrog-cli/utils/tests" - "github.com/jfrog/jfrog-client-go/utils/io/fileutils" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestPoetryInstall(t *testing.T) { - // Init poetry test. - initPoetryTest(t) - tests.SkipKnownFailingTest(t) - // Populate cli config with 'default' server. - oldHomeDir, newHomeDir := prepareHomeDir(t) - defer func() { - assert.NoError(t, os.Setenv(coreutils.HomeDir, oldHomeDir)) - assert.NoError(t, fileutils.RemoveTempDir(newHomeDir)) - }() - - // Create test cases. - allTests := []struct { - name string - project string - outputFolder string - moduleId string - args []string - cleanAfterExecution bool - }{ - {"poetry", "poetryproject", "cli-poetry-build", "cli-poetry-build:0.1.0", []string{"poetry", "install", "--build-name=" + tests.PoetryBuildName}, true}, - } - - // Run test cases. - for buildNumber, test := range allTests { - t.Run(test.name, func(t *testing.T) { - testPoetryCmd(t, createPoetryProject(t, test.outputFolder, test.project), strconv.Itoa(buildNumber), test.moduleId, test.args) - if test.cleanAfterExecution { - // cleanup - inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.PoetryBuildName, artHttpDetails) - } - }) - } - tests.CleanFileSystem() -} - -func testPoetryCmd(t *testing.T, projectPath, buildNumber, module string, args []string) { - wd, err := os.Getwd() - assert.NoError(t, err, "Failed to get current dir") - chdirCallback := clientTestUtils.ChangeDirWithCallback(t, wd, projectPath) - defer chdirCallback() - - args = append(args, "--build-number="+buildNumber) - - jfrogCli := tests.NewJfrogCli(execMain, "jf", "") - err = jfrogCli.WithoutCredentials().Exec(args...) - if err != nil { - assert.Fail(t, "Failed executing poetry install command", err.Error()) - return - } - - inttestutils.ValidateGeneratedBuildInfoModule(t, tests.PoetryBuildName, buildNumber, "", []string{module}, buildinfo.Python) - assert.NoError(t, artifactoryCli.Exec("bp", tests.PoetryBuildName, buildNumber)) - - publishedBuildInfo, found, err := tests.GetBuildInfo(serverDetails, tests.PoetryBuildName, buildNumber) - if err != nil { - assert.NoError(t, err) - return - } - if !found { - assert.True(t, found, "build info was expected to be found") - return - } - - buildInfo := publishedBuildInfo.BuildInfo - require.NotEmpty(t, buildInfo.Modules, "Poetry build info was not generated correctly, no modules were created.") - assert.Len(t, buildInfo.Modules[0].Dependencies, 3, "Incorrect number of artifacts found in the build-info") - assert.Equal(t, module, buildInfo.Modules[0].Id, "Unexpected module name") - assertPoetryDependenciesRequestedBy(t, buildInfo.Modules[0], module) -} - -func assertPoetryDependenciesRequestedBy(t *testing.T, module buildinfo.Module, moduleName string) { - for _, dependency := range module.Dependencies { - switch dependency.Id { - case "toml:0.10.2", "pexpect:4.8.0": - assert.EqualValues(t, [][]string{{moduleName}}, dependency.RequestedBy) - case "ptyprocess:0.7.0": - assert.EqualValues(t, [][]string{{"pexpect:4.8.0", moduleName}}, dependency.RequestedBy) - default: - assert.Fail(t, "Unexpected dependency "+dependency.Id) - } - } -} - -func createPoetryProject(t *testing.T, outFolder, projectName string) string { - projectSrc := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "poetry", projectName) - projectTarget := filepath.Join(tests.Out, outFolder+"-poetry-"+projectName) - err := fileutils.CreateDirIfNotExist(projectTarget) - assert.NoError(t, err) - - // Copy poetry project - err = biutils.CopyDir(projectSrc, projectTarget, true, nil) - assert.NoError(t, err) - - // Copy poetry-config file. - configSrc := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "poetry", "poetry.yaml") - configTarget := filepath.Join(projectTarget, ".jfrog", "projects") - _, err = tests.ReplaceTemplateVariables(configSrc, configTarget) - assert.NoError(t, err) - return projectTarget -} - -func initPoetryTest(t *testing.T) { - if !*tests.TestPoetry { - t.Skip("Skipping Poetry test. To run Poetry test add the '-test.poetry=true' option.") - } - require.True(t, isRepoExist(tests.PoetryRemoteRepo), tests.PoetryRemoteRepo+" test repository doesn't exist.") - require.True(t, isRepoExist(tests.PoetryVirtualRepo), tests.PoetryVirtualRepo+" test repository doesn't exist.") -} diff --git a/testdata/poetry/poetry.yaml b/testdata/poetry/poetry.yaml deleted file mode 100644 index b590b9e4f..000000000 --- a/testdata/poetry/poetry.yaml +++ /dev/null @@ -1,5 +0,0 @@ -version: 1 -type: poetry -resolver: - repo: ${POETRY_VIRTUAL_REPO} - serverId: default \ No newline at end of file diff --git a/testdata/poetry/poetryproject/poetry.lock b/testdata/poetry/poetryproject/poetry.lock deleted file mode 100644 index dad791dc6..000000000 --- a/testdata/poetry/poetryproject/poetry.lock +++ /dev/null @@ -1,45 +0,0 @@ -[[package]] -name = "pexpect" -version = "4.8.0" -description = "Pexpect allows easy control of interactive console applications." -category = "main" -optional = false -python-versions = "*" - -[package.dependencies] -ptyprocess = ">=0.5" - -[[package]] -name = "ptyprocess" -version = "0.7.0" -description = "Run a subprocess in a pseudo terminal" -category = "main" -optional = false -python-versions = "*" - -[[package]] -name = "toml" -version = "0.10.2" -description = "Python Library for Tom's Obvious, Minimal Language" -category = "main" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" - -[metadata] -lock-version = "1.1" -python-versions = "*" -content-hash = "c22eacac00585ca6c65bbb1e992145332c3a3c9da9714ea29d9d90e6dfe9924b" - -[metadata.files] -pexpect = [ - {file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"}, - {file = "pexpect-4.8.0.tar.gz", hash = "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"}, -] -ptyprocess = [ - {file = "ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35"}, - {file = "ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220"}, -] -toml = [ - {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, - {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, -] diff --git a/testdata/poetry/poetryproject/pyproject.toml b/testdata/poetry/poetryproject/pyproject.toml deleted file mode 100644 index d056175a5..000000000 --- a/testdata/poetry/poetryproject/pyproject.toml +++ /dev/null @@ -1,16 +0,0 @@ -[tool.poetry] -name = "cli-poetry-build" -version = "0.1.0" -description = "" -authors = ["Tal Arian "] - -[tool.poetry.dependencies] -python = "*" -toml = "0.10.2" -pexpect = "4.8.0" - -[tool.poetry.dev-dependencies] - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" diff --git a/utils/tests/consts.go b/utils/tests/consts.go index b6e99dc77..576b39cba 100644 --- a/utils/tests/consts.go +++ b/utils/tests/consts.go @@ -82,8 +82,6 @@ const ( PypiVirtualRepositoryConfig = "pypi_virtual_repository_config.json" PipenvRemoteRepositoryConfig = "pipenv_remote_repository_config.json" PipenvVirtualRepositoryConfig = "pipenv_virtual_repository_config.json" - PoetryRemoteRepositoryConfig = "poetry_remote_repository_config.json" - PoetryVirtualRepositoryConfig = "poetry_virtual_repository_config.json" RepoDetailsUrl = "api/repositories/" ServerId = "testServerId" SearchPromotedDocker = "search_promoted_docker.json" @@ -176,8 +174,6 @@ var ( PypiVirtualRepo = "cli-pypi-virtual" PipenvRemoteRepo = "cli-pipenv-pypi-remote" PipenvVirtualRepo = "cli-pipenv-pypi-virtual" - PoetryRemoteRepo = "cli-poetry-pypi-remote" - PoetryVirtualRepo = "cli-poetry-pypi-virtual" DockerLocalRepo = "cli-docker-local" DockerLocalPromoteRepo = "cli-docker-local-promote" DockerRemoteRepo = "cli-docker-remote" @@ -206,7 +202,6 @@ var ( NuGetBuildName = "cli-nuget-build" PipBuildName = "cli-pip-build" PipenvBuildName = "cli-pipenv-build" - PoetryBuildName = "cli-poetry-build" RtBuildName1 = "cli-rt-build1" RtBuildName2 = "cli-rt-build2" RtBuildNameWithSpecialChars = "cli-rt-a$+~&^a#-build3" diff --git a/utils/tests/utils.go b/utils/tests/utils.go index 19540b144..b3eeb3950 100644 --- a/utils/tests/utils.go +++ b/utils/tests/utils.go @@ -65,7 +65,6 @@ var ( TestNuget *bool TestPip *bool TestPipenv *bool - TestPoetry *bool TestPlugins *bool TestXray *bool TestAccess *bool @@ -101,7 +100,6 @@ func init() { TestNuget = flag.Bool("test.nuget", false, "Test Nuget") TestPip = flag.Bool("test.pip", false, "Test Pip") TestPipenv = flag.Bool("test.pipenv", false, "Test Pipenv") - TestPoetry = flag.Bool("test.poetry", false, "Test Poetry") TestPlugins = flag.Bool("test.plugins", false, "Test Plugins") TestXray = flag.Bool("test.xray", false, "Test Xray") TestAccess = flag.Bool("test.access", false, "Test Access") @@ -341,8 +339,6 @@ var reposConfigMap = map[*string]string{ &PypiVirtualRepo: PypiVirtualRepositoryConfig, &PipenvRemoteRepo: PipenvRemoteRepositoryConfig, &PipenvVirtualRepo: PipenvVirtualRepositoryConfig, - &PoetryRemoteRepo: PoetryRemoteRepositoryConfig, - &PoetryVirtualRepo: PoetryVirtualRepositoryConfig, &RtDebianRepo: DebianTestRepositoryConfig, &RtLfsRepo: GitLfsTestRepositoryConfig, &RtRepo1: Repo1RepositoryConfig, @@ -400,7 +396,6 @@ func GetNonVirtualRepositories() map[*string]string { TestNuget: {&NugetRemoteRepo}, TestPip: {&PypiRemoteRepo}, TestPipenv: {&PipenvRemoteRepo}, - TestPoetry: {&PoetryRemoteRepo}, TestPlugins: {&RtRepo1}, TestXray: {}, TestAccess: {&RtRepo1}, @@ -425,7 +420,6 @@ func GetVirtualRepositories() map[*string]string { TestNuget: {}, TestPip: {&PypiVirtualRepo}, TestPipenv: {&PipenvVirtualRepo}, - TestPoetry: {&PoetryVirtualRepo}, TestPlugins: {}, TestXray: {}, TestAccess: {}, @@ -461,7 +455,6 @@ func GetBuildNames() []string { TestNuget: {&NuGetBuildName}, TestPip: {&PipBuildName}, TestPipenv: {&PipenvBuildName}, - TestPoetry: {&PoetryBuildName}, TestPlugins: {}, TestXray: {}, TestAccess: {}, @@ -509,8 +502,6 @@ func getSubstitutionMap() map[string]string { "${PYPI_VIRTUAL_REPO}": PypiVirtualRepo, "${PIPENV_REMOTE_REPO}": PipenvRemoteRepo, "${PIPENV_VIRTUAL_REPO}": PipenvVirtualRepo, - "${POETRY_REMOTE_REPO}": PoetryRemoteRepo, - "${POETRY_VIRTUAL_REPO}": PoetryVirtualRepo, "${BUILD_NAME1}": RtBuildName1, "${BUILD_NAME2}": RtBuildName2, "${BUNDLE_NAME}": BundleName, @@ -567,8 +558,6 @@ func AddTimestampToGlobalVars() { PypiVirtualRepo += uniqueSuffix PipenvRemoteRepo += uniqueSuffix PipenvVirtualRepo += uniqueSuffix - PoetryRemoteRepo += uniqueSuffix - PoetryVirtualRepo += uniqueSuffix RtDebianRepo += uniqueSuffix RtLfsRepo += uniqueSuffix RtRepo1 += uniqueSuffix @@ -592,7 +581,6 @@ func AddTimestampToGlobalVars() { NuGetBuildName += uniqueSuffix PipBuildName += uniqueSuffix PipenvBuildName += uniqueSuffix - PoetryBuildName += uniqueSuffix RtBuildName1 += uniqueSuffix RtBuildName2 += uniqueSuffix RtBuildNameWithSpecialChars += uniqueSuffix