Skip to content

Commit

Permalink
Fix unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
robinholzi committed Apr 27, 2024
1 parent e3d209a commit 39d11eb
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include *.md
include alembic.ini
include config.toml
include dev_config.toml
include environment.yml
include init_db.py
include .flake8
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pip install -e .
Use the CLI to create a `Quetz` instance:

```bash
quetz run test_quetz --copy-conf ./config.toml --dev --reload
quetz run test_quetz --copy-conf ./dev_config.toml --dev --reload
```

Links:
Expand Down Expand Up @@ -188,7 +188,7 @@ sudo -u postgres psql -h localhost -c 'CREATE DATABASE quetz OWNER postgres;'

### Deploying Quetz with PostgreSQL backend

Then in your configuration file (such as `config.toml`) replace the `[sqlalchemy]` section with:
Then in your configuration file (such as `dev_config.toml`) replace the `[sqlalchemy]` section with:

```ini
[sqlalchemy]
Expand Down
3 changes: 0 additions & 3 deletions config.toml → dev_config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[general]
dev = true

[github]
# Register the app here: https://github.com/settings/applications/new
Expand All @@ -24,4 +22,3 @@ admins = ["dummy:alice"]

[profiling]
enable_sampling = false

2 changes: 1 addition & 1 deletion docs/source/deploying/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Config file

Most functionalities of quetz can be configured with a config file in toml format, such as this one:

.. literalinclude:: ../../../config.toml
.. literalinclude:: ../../../dev_config.toml


``sqlalchemy`` section
Expand Down
2 changes: 1 addition & 1 deletion plugins/quetz_content_trust/docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Few scripts are provided to perform a manual integration test of package signing
This is intended to be used by channels owners/maintainers to get familiar with the workflow of generating TUF roles (delegations, etc.) and push them on a Quetz server.

For that, simply run the 2 following commands from your quetz source directory:
- `quetz run test_quetz --copy-conf ./config.toml --dev --reload --delete` to get an up and running server
- `quetz run test_quetz --copy-conf ./dev_config.toml --dev --reload --delete` to get an up and running server
- `python plugins/quetz_content_trust/docs/test_script.py` to generate TUF roles, push them on the server but also push an empty `test-package` package

then just test from client side: `micromamba create -n foo -c http://127.0.0.1:8000/get/channel0 test-package --no-rc -y -vvv --repodata-ttl=0 --experimental --verify-artifacts`
Expand Down
6 changes: 3 additions & 3 deletions quetz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def create(
],
copy_conf: Annotated[
Optional[str],
typer.Option(help="The configuration to copy from (e.g. config.toml)"),
typer.Option(help="The configuration to copy from (e.g. dev_config.toml)"),
] = None,
create_conf: Annotated[
bool,
Expand Down Expand Up @@ -481,7 +481,7 @@ def create(
shutil.copyfile(copy_conf, config_file)

if not config_file.exists() and create_conf:
conf = create_config(https=str(config.is_dev() if config else True))
conf = create_config(https=str(config.is_dev() if config else True).lower())
with open(config_file, "w") as f:
f.write(conf)

Expand Down Expand Up @@ -602,7 +602,7 @@ def run(
path: Annotated[str, typer.Argument(help="The path of the deployment")],
copy_conf: Annotated[
Optional[str],
typer.Option(help="The configuration to copy from (e.g. config.toml)"),
typer.Option(help="The configuration to copy from (e.g. dev_config.toml)"),
] = None,
create_conf: Annotated[
bool,
Expand Down
5 changes: 3 additions & 2 deletions quetz/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging.config
import os
from distutils.util import strtobool
from pathlib import Path
from secrets import token_bytes
from typing import Any, Dict, Iterable, List, NamedTuple, Optional, Type, Union

Expand Down Expand Up @@ -59,7 +60,7 @@ class Config:
ConfigSection(
"general",
[
ConfigEntry("dev", bool, required=True),
ConfigEntry("dev", bool, required=True, default=False),
ConfigEntry("package_unpack_threads", int, 1),
ConfigEntry("frontend_dir", str, default=""),
ConfigEntry("redirect_http_to_https", bool, False),
Expand Down Expand Up @@ -244,7 +245,7 @@ def __new__(cls, deployment_config: str = None):
return cls._instances[None]

try:
path = os.path.abspath(cls.find_file(deployment_config))
path = str(Path(cls.find_file(deployment_config)).absolute().resolve())
except TypeError:
# if not config path exists, set it to empty string.
path = ""
Expand Down
2 changes: 1 addition & 1 deletion set_env_dev.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export QUETZ_CONFIG_FILE="${PWD}/config.toml"
export QUETZ_CONFIG_FILE="${PWD}/dev_config.toml"

0 comments on commit 39d11eb

Please sign in to comment.