File size: 868 Bytes
079c32c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from time import sleep
import pytest
import pathlib
import os
from ding.entry.cli_ditask import _cli_ditask


def cli_ditask_main():
    sleep(0.1)


@pytest.mark.unittest
def test_cli_ditask():
    kwargs = {
        "package": os.path.dirname(pathlib.Path(__file__)),
        "main": "test_cli_ditask.cli_ditask_main",
        "parallel_workers": 1,
        "topology": "mesh",
        "platform": "k8s",
        "protocol": "tcp",
        "ports": 50501,
        "attach_to": "",
        "address": "127.0.0.1",
        "labels": "",
        "node_ids": 0,
        "mq_type": "nng",
        "redis_host": "",
        "redis_port": "",
        "startup_interval": 1
    }
    os.environ["DI_NODES"] = '127.0.0.1'
    os.environ["DI_RANK"] = '0'
    try:
        _cli_ditask(**kwargs)
    finally:
        del os.environ["DI_NODES"]
        del os.environ["DI_RANK"]