Skip to content
This repository was archived by the owner on Nov 21, 2023. It is now read-only.
This repository was archived by the owner on Nov 21, 2023. It is now read-only.

Investigate automated testing #5

Description

@redmie

There is a need to automate testing in order to ensure the server works well with anki.
This task is hard.

In terms of sync tests we should have:

  1. Empty anki syncs to empty server
  2. Anki with text decks syncs to empty server
  3. Anki with more text decks sync to partially synced server server (from step 2)
  4. Anki media decks syncs to empty server
  5. Same as 3 for media decks
  6. Anki syncs decks with history that conflict server

In terms of client tested with should have:

  • anki desktop
  • ankidroid
  • anki on IOS (I see no way to automate testing for this one, not a priority for me)

The success conditions are:

  • No client error (or specific error if it is the test goal)
  • No server error
  • All data correctly synced

Please tell me if you see things I have forgotten.

Road to automated testing is long, I think the first steps are:

  • Run anki desktop in container
  • Control anki desktop in the container
  • Run ankidroid in container
  • Control ankidroid in container
  • Write basic sync test (empty/empty)

I managed to run the latest anki desktop in a debian:stable-slim container using the xvfb virtual framebuffer.
Anki is thus running but one cannot access the GUI directly (it would not be useful for testing anyway).
If you have any idea on how to remote control it (using anki repl, qt testing, whatever...), I'm all hears!


Under AGPL3, POC Containerfile for testing:

FROM rust:latest as builder
WORKDIR /usr/src/anki-sync-server-rs
COPY . .
RUN cargo install --path .

FROM debian:stable as test
# Install tool needed to install deps & anki
RUN apt-get update && apt-get install -y aptitude wget bzip2 xvfb && rm -rf /var/lib/apt/lists/*
# Install anki official debian package deps
# See https://askubuntu.com/questions/74478/how-to-install-only-the-dependencies-of-a-package
RUN apt-get update && aptitude search '!~i?reverse-depends("^anki$")' -F "%p" | xargs apt-get install -y && rm -rf /var/lib/apt/lists/*
# Set C.UTF8 local for anki to start
RUN echo 'export LC_CTYPE=C.UTF-8' >> /etc/profile
# Help qt to find xvfb screen
RUN echo 'export QT_QPA_PLATFORM=minimal' >> /etc/profile





COPY --from=builder /usr/local/cargo/bin/ankisyncd /usr/local/bin/ankisyncd
COPY ./tests /usr/tests
CMD ["/usr/tests/run_all"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions