Skip to content
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

Move build to worker #945

Merged
merged 3 commits into from
Nov 1, 2024
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

from conda_store_server import api
from conda_store_server._internal import environment, schema, utils
from conda_store_server._internal.build import (
from conda_store_server._internal.worker.app import CondaStoreWorker
from conda_store_server._internal.worker.build import (
build_cleanup,
build_conda_docker,
build_conda_env_export,
Expand All @@ -26,7 +27,6 @@
build_constructor_installer,
solve_conda_environment,
)
from conda_store_server._internal.worker.app import CondaStoreWorker


@worker_ready.connect
Expand Down
44 changes: 44 additions & 0 deletions conda-store-server/tests/_internal/worker/test_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) conda-store development team. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

from conda_store_server import api
from conda_store_server._internal import schema
from conda_store_server._internal.worker import build


def test_build_started(db, seed_conda_store):
test_build = api.get_build(db, build_id=4)
assert test_build.status != schema.BuildStatus.BUILDING
build.set_build_started(db, test_build)
test_build = api.get_build(db, build_id=4)
assert test_build.status == schema.BuildStatus.BUILDING


def test_build_failed(db, seed_conda_store):
test_build = api.get_build(db, build_id=4)
assert test_build.status != schema.BuildStatus.FAILED
build.set_build_failed(db, test_build)
test_build = api.get_build(db, build_id=4)
assert test_build.status == schema.BuildStatus.FAILED


def test_build_canceled(db, seed_conda_store):
test_build = api.get_build(db, build_id=4)
assert test_build.status != schema.BuildStatus.CANCELED
build.set_build_canceled(db, test_build)
test_build = api.get_build(db, build_id=4)
assert test_build.status == schema.BuildStatus.CANCELED


def test_build_completed(db, conda_store, seed_conda_store):
test_build = api.get_build(db, build_id=2)
assert test_build.status != schema.BuildStatus.COMPLETED
build.set_build_completed(db, conda_store, test_build)
test_build = api.get_build(db, build_id=2)
assert test_build.status == schema.BuildStatus.COMPLETED
assert test_build.environment.current_build == test_build
build_artifact = api.get_build_artifact(
db, 2, str(test_build.build_path(conda_store))
)
assert build_artifact is not None
Loading