charmkeeper-tests

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Plan:
  • Find the unit tests in the repository (their could be multiple "tests/unit" folders).
  • Ensure each set of unit tests is following the implementation standards.
  • Run the tests to ensure the code work as expected.
计划:
  • 在代码仓库中查找单元测试(可能存在多个"tests/unit"文件夹)。
  • 确保每一组单元测试都符合实现标准。
  • 运行测试以确保代码按预期工作。

Implementation standards

实现标准

  • Unit test should be implemented with
    ops.testing
    , not
    harness
    .
  • Lint produced code with
    tox -e lint
    .
  • 单元测试应使用
    ops.testing
    实现,而非
    harness
  • 使用
    tox -e lint
    对生成的代码进行代码检查。

Testing

测试

Writing unit tests

编写单元测试

Local testing

本地测试

The unit tests should be run in a virtual machine named "charmkeeper".
If the machine doesn't exist, create it with:
scripts/create-charmkeeper-vm.sh
.
If not already done, mount the working directory folder in the machine with
bash
multipass mount --type native $PWD charmkeeper:/workdir
Look at CONTRIBUTING.md to see if there are specific instructions to test the charm.
Unless there is something specific mentioned, you should be able to run the tests with:
bash
multipass exec charmkeeper -d /workdir/ -- tox 
单元测试应在名为"charmkeeper"的虚拟机中运行。
如果该虚拟机不存在,请使用以下命令创建:
scripts/create-charmkeeper-vm.sh
如果尚未挂载工作目录,请使用以下命令将工作目录挂载到虚拟机中:
bash
multipass mount --type native $PWD charmkeeper:/workdir
查看CONTRIBUTING.md文件,确认是否有测试该charm的特定说明。
除非有特别说明,否则你可以使用以下命令运行测试:
bash
multipass exec charmkeeper -d /workdir/ -- tox