Skip to content

Commit 0848437

Browse files
authored
refactor:integration tests (#14)
* refactor: moved all integration tests together Keeping them split showed several issues: - Concurrent access to the cache is not working (fixed by using one cache per test suit) - Each suit would rebuild all its the dependencies which means that the cost on disk would balloon as well as the time spent to rebuild the same artifacts - Each suit being independent, in the package sense, means sharing package level variables such as settings was not possible. * chore(workflows): remove push to gcr * refactor: moved all pkg to pkg/packagers This follows the same scheme as python-installers. * chore(test): disable Pip offline test for amazonlinux It is not tested in the pip buildpack and it's currently failing during cpython installation. The symlink creation from python3 to python fails.
1 parent 740a737 commit 0848437

File tree

9,994 files changed

+279
-612
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

9,994 files changed

+279
-612
lines changed

.github/workflows/push-buildpackage.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ jobs:
3939
exit 1
4040
fi
4141
42-
- name: Push to GCR
43-
env:
44-
GCR_PUSH_BOT_JSON_KEY: ${{ secrets.GCR_PUSH_BOT_JSON_KEY }}
45-
run: |
46-
echo "${GCR_PUSH_BOT_JSON_KEY}" | sudo skopeo login --username _json_key --password-stdin gcr.io
47-
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_full }}"
48-
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_minor }}"
49-
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_major }}"
50-
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:latest"
51-
5242
- name: Push to DockerHub
5343
id: push
5444
env:

REUSE.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ SPDX-FileCopyrightText = "Copyright (c) 2013-Present CloudFoundry.org Foundation
2424
SPDX-License-Identifier = "Apache-2.0"
2525

2626
[[annotations]]
27-
path = "integration/**/integration.json"
27+
path = "integration.json"
2828
precedence = "override"
2929
SPDX-FileCopyrightText = "Copyright (c) 2013-Present CloudFoundry.org Foundation, Inc. All Rights Reserved."
3030
SPDX-License-Identifier = "Apache-2.0"
3131

3232
[[annotations]]
33-
path = "pkg/pipenv/Pipfile.lock"
33+
path = "pkg/packagers/pipenv/Pipfile.lock"
3434
precedence = "override"
3535
SPDX-FileCopyrightText = "Copyright (c) 2013-Present CloudFoundry.org Foundation, Inc. All Rights Reserved."
3636
SPDX-License-Identifier = "Apache-2.0"

build.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
"github.com/paketo-buildpacks/packit/v2"
1010
"github.com/paketo-buildpacks/packit/v2/scribe"
1111

12-
conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
13-
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/pip"
14-
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
15-
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
12+
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
13+
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
14+
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
15+
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"
1616

17-
pythonpackagers "github.com/paketo-buildpacks/python-packagers/pkg/common"
17+
pythonpackagers "github.com/paketo-buildpacks/python-packagers/pkg/packagers/common"
1818
)
1919

2020
// filtered returns the slice passed in parameter with the needle removed

build_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ import (
1717
"github.com/paketo-buildpacks/packit/v2/scribe"
1818

1919
pythonpackagers "github.com/paketo-buildpacks/python-packagers"
20-
pkgcommon "github.com/paketo-buildpacks/python-packagers/pkg/common"
21-
conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
22-
condafakes "github.com/paketo-buildpacks/python-packagers/pkg/conda/fakes"
23-
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/pip"
24-
pipfakes "github.com/paketo-buildpacks/python-packagers/pkg/pip/fakes"
25-
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
26-
pipenvfakes "github.com/paketo-buildpacks/python-packagers/pkg/pipenv/fakes"
27-
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
28-
poetryfakes "github.com/paketo-buildpacks/python-packagers/pkg/poetry/fakes"
20+
pkgcommon "github.com/paketo-buildpacks/python-packagers/pkg/packagers/common"
21+
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
22+
condafakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda/fakes"
23+
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
24+
pipfakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip/fakes"
25+
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
26+
pipenvfakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv/fakes"
27+
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"
28+
poetryfakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry/fakes"
2929

3030
"github.com/sclevine/spec"
3131

detect.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"github.com/paketo-buildpacks/packit/v2"
1010
"github.com/paketo-buildpacks/packit/v2/scribe"
1111

12-
conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
13-
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/pip"
14-
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
15-
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
12+
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
13+
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
14+
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
15+
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"
1616
)
1717

1818
// Detect will return a packit.DetectFunc that will be invoked during the

detect_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
"github.com/paketo-buildpacks/packit/v2"
1515
"github.com/paketo-buildpacks/packit/v2/scribe"
1616
pythonpackagers "github.com/paketo-buildpacks/python-packagers"
17-
conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
18-
pip "github.com/paketo-buildpacks/python-packagers/pkg/pip"
19-
pipenv "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
20-
poetry "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
17+
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
18+
pip "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
19+
pipenv "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
20+
poetry "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"
2121

2222
"github.com/sclevine/spec"
2323

integration.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"builders":
3+
[
4+
"index.docker.io/paketobuildpacks/builder:buildpackless-base",
5+
"index.docker.io/paketobuildpacks/builder-jammy-buildpackless-base:latest",
6+
"index.docker.io/jericop/amazonlinux-builder:base"
7+
],
8+
"miniconda": "github.com/paketo-buildpacks/miniconda",
9+
"cpython": "github.com/paketo-buildpacks/cpython",
10+
"pip": "github.com/paketo-buildpacks/pip",
11+
"pipenv": "github.com/paketo-buildpacks/pipenv",
12+
"poetry": "github.com/paketo-buildpacks/poetry",
13+
"build-plan": "github.com/paketo-community/build-plan"
14+
}

integration/conda/init_test.go

Lines changed: 0 additions & 96 deletions
This file was deleted.

integration/conda/integration.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

integration/helpers.go

Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,63 @@
55

66
package integration_helpers
77

8-
import (
9-
"os"
10-
"path/filepath"
8+
type Buildpack struct {
9+
ID string
10+
Name string
11+
}
12+
13+
type Dependency struct {
14+
ID string
15+
Version string
16+
}
1117

12-
"github.com/ForestEckhardt/freezer"
13-
"github.com/ForestEckhardt/freezer/github"
14-
"github.com/paketo-buildpacks/occam"
15-
"github.com/paketo-buildpacks/occam/packagers"
16-
)
18+
type Metadata struct {
19+
Dependencies []Dependency
20+
}
21+
22+
type BuildpackInfo struct {
23+
Buildpack Buildpack
24+
Metadata Metadata
25+
}
1726

18-
func NewBuildpackStore(suffix string) occam.BuildpackStore {
19-
gitToken := os.Getenv("GIT_TOKEN")
20-
cacheManager := freezer.NewCacheManager(filepath.Join(os.Getenv("HOME"), ".freezer-cache", suffix))
21-
releaseService := github.NewReleaseService(github.NewConfig("https://api.github.com", gitToken))
22-
packager := packagers.NewJam()
23-
namer := freezer.NewNameGenerator()
27+
type TestSettings struct {
28+
Buildpacks struct {
29+
// Dependency buildpacks
30+
Miniconda struct {
31+
Online string
32+
Offline string
33+
}
34+
CPython struct {
35+
Online string
36+
Offline string
37+
}
38+
Pip struct {
39+
Online string
40+
Offline string
41+
}
42+
Pipenv struct {
43+
Online string
44+
Offline string
45+
}
46+
Poetry struct {
47+
Online string
48+
}
49+
BuildPlan struct {
50+
Online string
51+
}
52+
// This buildpack
53+
PythonPackagers struct {
54+
Online string
55+
Offline string
56+
}
57+
}
2458

25-
return occam.NewBuildpackStore().WithLocalFetcher(
26-
freezer.NewLocalFetcher(
27-
&cacheManager,
28-
packager,
29-
namer,
30-
)).WithRemoteFetcher(
31-
freezer.NewRemoteFetcher(
32-
&cacheManager,
33-
releaseService, packager,
34-
)).WithCacheManager(
35-
&cacheManager,
36-
)
59+
Config struct {
60+
Miniconda string `json:"miniconda"`
61+
CPython string `json:"cpython"`
62+
Pip string `json:"pip"`
63+
Pipenv string `json:"pipenv"`
64+
Poetry string `json:"poetry"`
65+
BuildPlan string `json:"build-plan"`
66+
}
3767
}

0 commit comments

Comments
 (0)