Skip to content

refactor:integration tests #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 0 additions & 10 deletions .github/workflows/push-buildpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ jobs:
exit 1
fi

- name: Push to GCR
env:
GCR_PUSH_BOT_JSON_KEY: ${{ secrets.GCR_PUSH_BOT_JSON_KEY }}
run: |
echo "${GCR_PUSH_BOT_JSON_KEY}" | sudo skopeo login --username _json_key --password-stdin gcr.io
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_full }}"
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_minor }}"
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_major }}"
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:latest"

- name: Push to DockerHub
id: push
env:
Expand Down
4 changes: 2 additions & 2 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ SPDX-FileCopyrightText = "Copyright (c) 2013-Present CloudFoundry.org Foundation
SPDX-License-Identifier = "Apache-2.0"

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

[[annotations]]
path = "pkg/pipenv/Pipfile.lock"
path = "pkg/packagers/pipenv/Pipfile.lock"
precedence = "override"
SPDX-FileCopyrightText = "Copyright (c) 2013-Present CloudFoundry.org Foundation, Inc. All Rights Reserved."
SPDX-License-Identifier = "Apache-2.0"
10 changes: 5 additions & 5 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
"github.com/paketo-buildpacks/packit/v2"
"github.com/paketo-buildpacks/packit/v2/scribe"

conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/pip"
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"

pythonpackagers "github.com/paketo-buildpacks/python-packagers/pkg/common"
pythonpackagers "github.com/paketo-buildpacks/python-packagers/pkg/packagers/common"
)

// filtered returns the slice passed in parameter with the needle removed
Expand Down
18 changes: 9 additions & 9 deletions build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import (
"github.com/paketo-buildpacks/packit/v2/scribe"

pythonpackagers "github.com/paketo-buildpacks/python-packagers"
pkgcommon "github.com/paketo-buildpacks/python-packagers/pkg/common"
conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
condafakes "github.com/paketo-buildpacks/python-packagers/pkg/conda/fakes"
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/pip"
pipfakes "github.com/paketo-buildpacks/python-packagers/pkg/pip/fakes"
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
pipenvfakes "github.com/paketo-buildpacks/python-packagers/pkg/pipenv/fakes"
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
poetryfakes "github.com/paketo-buildpacks/python-packagers/pkg/poetry/fakes"
pkgcommon "github.com/paketo-buildpacks/python-packagers/pkg/packagers/common"
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
condafakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda/fakes"
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
pipfakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip/fakes"
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
pipenvfakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv/fakes"
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"
poetryfakes "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry/fakes"

"github.com/sclevine/spec"

Expand Down
8 changes: 4 additions & 4 deletions detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/paketo-buildpacks/packit/v2"
"github.com/paketo-buildpacks/packit/v2/scribe"

conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/pip"
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
pipinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
pipenvinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
poetryinstall "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"
)

// Detect will return a packit.DetectFunc that will be invoked during the
Expand Down
8 changes: 4 additions & 4 deletions detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/paketo-buildpacks/packit/v2"
"github.com/paketo-buildpacks/packit/v2/scribe"
pythonpackagers "github.com/paketo-buildpacks/python-packagers"
conda "github.com/paketo-buildpacks/python-packagers/pkg/conda"
pip "github.com/paketo-buildpacks/python-packagers/pkg/pip"
pipenv "github.com/paketo-buildpacks/python-packagers/pkg/pipenv"
poetry "github.com/paketo-buildpacks/python-packagers/pkg/poetry"
conda "github.com/paketo-buildpacks/python-packagers/pkg/packagers/conda"
pip "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pip"
pipenv "github.com/paketo-buildpacks/python-packagers/pkg/packagers/pipenv"
poetry "github.com/paketo-buildpacks/python-packagers/pkg/packagers/poetry"

"github.com/sclevine/spec"

Expand Down
14 changes: 14 additions & 0 deletions integration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"builders":
[
"index.docker.io/paketobuildpacks/builder:buildpackless-base",
"index.docker.io/paketobuildpacks/builder-jammy-buildpackless-base:latest",
"index.docker.io/jericop/amazonlinux-builder:base"
],
"miniconda": "github.com/paketo-buildpacks/miniconda",
"cpython": "github.com/paketo-buildpacks/cpython",
"pip": "github.com/paketo-buildpacks/pip",
"pipenv": "github.com/paketo-buildpacks/pipenv",
"poetry": "github.com/paketo-buildpacks/poetry",
"build-plan": "github.com/paketo-community/build-plan"
}
96 changes: 0 additions & 96 deletions integration/conda/init_test.go

This file was deleted.

9 changes: 0 additions & 9 deletions integration/conda/integration.json

This file was deleted.

82 changes: 56 additions & 26 deletions integration/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,63 @@

package integration_helpers

import (
"os"
"path/filepath"
type Buildpack struct {
ID string
Name string
}

type Dependency struct {
ID string
Version string
}

"github.com/ForestEckhardt/freezer"
"github.com/ForestEckhardt/freezer/github"
"github.com/paketo-buildpacks/occam"
"github.com/paketo-buildpacks/occam/packagers"
)
type Metadata struct {
Dependencies []Dependency
}

type BuildpackInfo struct {
Buildpack Buildpack
Metadata Metadata
}

func NewBuildpackStore(suffix string) occam.BuildpackStore {
gitToken := os.Getenv("GIT_TOKEN")
cacheManager := freezer.NewCacheManager(filepath.Join(os.Getenv("HOME"), ".freezer-cache", suffix))
releaseService := github.NewReleaseService(github.NewConfig("https://api.github.com", gitToken))
packager := packagers.NewJam()
namer := freezer.NewNameGenerator()
type TestSettings struct {
Buildpacks struct {
// Dependency buildpacks
Miniconda struct {
Online string
Offline string
}
CPython struct {
Online string
Offline string
}
Pip struct {
Online string
Offline string
}
Pipenv struct {
Online string
Offline string
}
Poetry struct {
Online string
}
BuildPlan struct {
Online string
}
// This buildpack
PythonPackagers struct {
Online string
Offline string
}
}

return occam.NewBuildpackStore().WithLocalFetcher(
freezer.NewLocalFetcher(
&cacheManager,
packager,
namer,
)).WithRemoteFetcher(
freezer.NewRemoteFetcher(
&cacheManager,
releaseService, packager,
)).WithCacheManager(
&cacheManager,
)
Config struct {
Miniconda string `json:"miniconda"`
CPython string `json:"cpython"`
Pip string `json:"pip"`
Pipenv string `json:"pipenv"`
Poetry string `json:"poetry"`
BuildPlan string `json:"build-plan"`
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
. "github.com/paketo-buildpacks/occam/matchers"
)

func testDefault(t *testing.T, context spec.G, it spec.S) {
func condaTestDefault(t *testing.T, context spec.G, it spec.S) {
var (
Expect = NewWithT(t).Expect
Eventually = NewWithT(t).Eventually
Expand All @@ -44,7 +44,7 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
name, err = occam.RandomName()
Expect(err).NotTo(HaveOccurred())

source, err = occam.Source(filepath.Join("testdata", "default_app"))
source, err = occam.Source(filepath.Join("testdata", "conda", "default_app"))
Expect(err).NotTo(HaveOccurred())
})

Expand All @@ -62,9 +62,9 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
image, logs, err = pack.WithNoColor().Build.
WithPullPolicy("never").
WithBuildpacks(
minicondaBuildpack,
buildpack,
buildPlanBuildpack,
settings.Buildpacks.Miniconda.Online,
settings.Buildpacks.PythonPackagers.Online,
settings.Buildpacks.BuildPlan.Online,
).
Execute(name, source)
Expect(err).NotTo(HaveOccurred(), logs.String())
Expand All @@ -91,7 +91,7 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
Expect(err).NotTo(HaveOccurred())
Expect(os.Chmod(sbomDir, os.ModePerm)).To(Succeed())

source, err = occam.Source(filepath.Join("testdata", "vendored_app"))
source, err = occam.Source(filepath.Join("testdata", "conda", "vendored_app"))
Expect(err).NotTo(HaveOccurred())
})

Expand All @@ -106,9 +106,9 @@ func testDefault(t *testing.T, context spec.G, it spec.S) {
image, logs, err = pack.WithNoColor().Build.
WithPullPolicy("never").
WithBuildpacks(
minicondaBuildpack,
buildpack,
buildPlanBuildpack,
settings.Buildpacks.Miniconda.Online,
settings.Buildpacks.PythonPackagers.Online,
settings.Buildpacks.BuildPlan.Online,
).
WithEnv(map[string]string{
"BP_LOG_LEVEL": "DEBUG",
Expand Down
Loading
Loading