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

Cannot run local tests #3022

Closed
kimsible opened this issue Jul 29, 2020 · 4 comments
Closed

Cannot run local tests #3022

kimsible opened this issue Jul 29, 2020 · 4 comments
Labels
Status: To Reproduce Likely a bug but needs reproduction and/or extended log from the issuer

Comments

@kimsible
Copy link
Contributor

It was an old issue, it's more a doc update for a docker-compose dev env with tests.

After following the documentation https://docs.joinpeertube.org/#/contribute-getting-started?id=develop.

I was able to adapt to test env with a docker database and redis containers.

  1. Redis tools installation : sudo apt install redis-tools

  2. docker-compose.yml dev configuration

version: "3.3"

services:

  postgres:
    image: postgres:10-alpine
    environment:
      - POSTGRES_DB=peertube_dev
      - POSTGRES_USER=peertube
      - POSTGRES_PASSWORD=peertube
    volumes:
      - ../PeerTube/docker-volume/db:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  redis:
    image: redis:4-alpine
    volumes:
      - ../PeerTube/docker-volume/redis:/data
    ports:
      - "6379:6379"
    restart: "always"

networks:
  default:
    ipam:
      driver: default
      config:
      - subnet:  172.18.0.0/16
  1. I run docker-compose up -d in docker compose dev directory

Federation tests

I created the 3 databases for test, still in docker compose dev directory :

docker-compose exec -T postgres createdb -U peertube -O peertube peertube_test{1,2,3}

Unit tests
in docker compose dev directory :

docker-compose exec -T postgres createuser -U peertube --createdb --superuser

In PeerTube directory, I run yarn install, npm run build -- --light-fr and npm run clean:server:test

  • npm run test I got this error : Error: Module did not self-register. just after sass-lint
  • for single test unit (npm run mocha -- --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/index.ts) :
TSError: ⨯ Unable to compile TypeScript:
server/helpers/express-utils.ts:121:10 - error TS2367: This condition will always return 'true' since the types 'string | string[] | ParsedQs | ParsedQs[]' and 'boolean' have no overlap.

121   return req.query.skipCount !== true

Node and NPM version
node v12.18.2
npm v6.14.5

@Chocobozzz
Copy link
Owner

Try TS_NODE_FILES=true npm run mocha -- --exit -r ts-node/register -r tsconfig-paths/register --bail server/tests/api/index.ts

@Chocobozzz Chocobozzz added the Status: Waiting for answer Waiting issue author answer label Jul 31, 2020
@kimsible
Copy link
Contributor Author

kimsible commented Aug 2, 2020

Thanks the trick / config seems to work for the api tests but not for server/tests/index.ts in scripts/test.sh ran by npm test :

Error: Module did not self-register.

Edit: when setAccessTokensToServers is used in before() I get Error: expected 200 "OK", got 400 "Bad Request".

@Chocobozzz Chocobozzz added Status: To Reproduce Likely a bug but needs reproduction and/or extended log from the issuer and removed Status: Waiting for answer Waiting issue author answer labels Aug 24, 2020
@punmechanic
Copy link

punmechanic commented Sep 9, 2020

This also resolved my issue. Could we get the test script altered so it's the default? Or is there a significant behaviour difference?

@Chocobozzz
Copy link
Owner

Chocobozzz commented Nov 10, 2020

Should be fixed by 93ab838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: To Reproduce Likely a bug but needs reproduction and/or extended log from the issuer
Projects
None yet
Development

No branches or pull requests

3 participants