Skip to content

Commit aa803f8

Browse files
committed
internal: fix local testing
Local testing was broken because of the following: 1. the signature of `make_ipfs_client` changed but its use in migration scripts was not adapted, making it impossible to run the full chain of migration scripts 2. the Docker Compose file was using a custom port to expose Redis but the template config file did not specify this port. Fixed the usages of `make_ipfs_client` and removed the custom port for Redis.
1 parent fdbc0b8 commit aa803f8

File tree

3 files changed

+16
-34
lines changed

3 files changed

+16
-34
lines changed

README.md

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Aleph Core Channel Node (CCN)
22

3-
Next generation network of decentralized big data applications. Development follows the [Aleph Whitepaper](https://github.com/moshemalawach/aleph-whitepaper).
3+
Next generation network of decentralized cloud applications. Development follows the [Aleph Whitepaper](https://github.com/moshemalawach/aleph-whitepaper).
44

55
## Documentation
66

77
Albeit still incomplete as it is a work in progress, documentation
88
can be found at http://pyaleph.readthedocs.io/ or
9-
built from this repository with `$ python setup.py docs`
9+
built from this repository with `$ python setup.py docs`.
1010

1111
## Deployment
1212

@@ -66,45 +66,27 @@ nix-shell
6666
hatch run testing:test
6767
```
6868

69-
### Run test locally
69+
### Run tests locally
7070

71-
We do not recommend that you run tests directly on your machine because of the
72-
complexity of doing so but if you want to do it you need to:
71+
Running tests locally requires setting up a local test environment through Docker Compose.
72+
From the root of the project, run the following commands to start the environment:
7373

74-
- install [hatch](https://github.com/pypa/hatch), you can use pipx for that (`pipx install hatch`) or install it in a virtualenv
75-
- install postgresql, at least version 15.1, `apt install postgresql`
76-
- install redis, at least version 7, `apt install redis`
77-
- have de nightly version of rust install, you can use [rustup](https://rustup.rs/) for that and do a `rustup default nightly`
78-
79-
Then configure PostgreSQL for your local application using a `config.yml` file in the root of the project.
80-
81-
Here is an not extensible example configuration:
82-
83-
```yaml
84-
postgres:
85-
port: 5432
86-
user: username
87-
password: password
88-
host: # leave empty to use unix socket
74+
```shell
75+
# Copy the template config file for local development
76+
cp deployment/docker-build/config.yml .
77+
# Start the environment
78+
docker-compose -f deployment/docker-build/docker-compose.yml up -d
8979
```
9080

91-
All overloadable and default values can be found in `src/aleph/config.py` and
92-
you can also customize the redis connection this way.
93-
94-
The you can run:
81+
Once the environment is up, you can simply run tests from your IDE or from the command line:
9582

96-
```bash
97-
hatch run testing:test
83+
```shell
84+
pytest -v .
9885
```
9986

100-
Or any of the env you can see using `hatch env show`.
101-
102-
In case of doubt you can refer to the file `.github/workflows/pyaleph-ci.yml`,
103-
this is how it runs on our CI.
104-
10587
## Software used
10688

107-
The Aleph CCN is written in Python and requires Python v3.8+. It will not work with older versions of Python.
89+
The Aleph CCN is written in Python and requires Python v3.12+. It will not work with older versions of Python.
10890

10991
It also relies on [IPFS](https://ipfs.io/).
11092

deployment/docker-build/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ services:
8282
restart: always
8383
image: redis:7.0.10
8484
ports:
85-
- "127.0.0.1:6380:6379"
85+
- "127.0.0.1:6379:6379"
8686
networks:
8787
- pyaleph
8888

deployment/migrations/versions/0016_77e68941d36c_fix_ipfs_files_size.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def upgrade_async() -> None:
4545
).all()
4646

4747
config = get_config()
48-
ipfs_client = make_ipfs_client(config)
48+
ipfs_client = make_ipfs_client(host=config.ipfs.host.value, port=config.ipfs.port.value)
4949

5050
for file in files:
5151
stats = await stat_ipfs(ipfs_client, cid=file.hash)

0 commit comments

Comments
 (0)