Пример #1
0
 def test_a_functionality_with_percentage_50_enabled(self):
     self.rollout.enable(self.FN)
     self.rollout.set_percentage(self.FN, 50)
     user = Foo("1")
     self.rollout.is_enabled(self.FN, user) | should.be_false()
     u = Foo("2")
     self.rollout.is_enabled(self.FN, u) | should.be_true()
Пример #2
0
    def test_add_a_functionality_with_a_hundred_users(self):
        fn = "FOO"
        users = ["bar" + str(i) for i in range(100)]

        self.backend.add_functionality(Feature(fn, None, 0), users)

        for u in users:
            self.backend.is_enabled(fn, u) | should.be_true()

        self.backend.is_enabled(fn, "bar100") | should.be_false()
Пример #3
0
def then_workspace_deleted(_context):
    workspaceID = helpers.getWorkspaceID()
    workspace = Workspace()
    workspace.workspaceDelete(workspaceID)
    workspaceDeleteStatus = workspace.workspaceDeleteStatus(workspaceID)
    try:
        workspaceDeleteStatus | should.be_true().desc("Workspace was deleted.")
    except AssertionError as e:
        helpers.gather_pod_logs(_context, "che")
        raise e
Пример #4
0
def then_workspace_stopped(_context):
    workspaceID = helpers.getWorkspaceID()
    workspace = Workspace()
    workspace.workspaceStop(workspaceID)
    workspaceStatus = workspace.workspaceStatus(workspaceID, 10, "STOPPED")
    try:
        workspaceStatus | should.be_true().desc("Workspace is stopped.")
    except AssertionError as e:
        helpers.gather_pod_logs(_context, "che")
        raise e
Пример #5
0
def then_workspace_started(_context):
    workspaceID = helpers.getWorkspaceID()
    workspace = Workspace()
    workspaceStatus = workspace.workspaceStatus(workspaceID, 20, "RUNNING")
    try:
        workspaceStatus | should.be_true().desc(
            "Workspace is started and running.")
    except AssertionError as e:
        helpers.gather_pod_logs(_context, "che")
        raise e
Пример #6
0
    def test_add_a_functionality_with_a_hundred_users(self):
        fn = "FOO"
        users = ["bar" + str(i) for i in range(100)]

        self.backend.add_functionality(Feature(fn, None, 0), users)

        for u in users:
            self.backend.is_enabled(fn, u) | should.be_true()

        self.backend.is_enabled(fn, "bar100") | should.be_false()
Пример #7
0
def test_cli_graph():
    with TemporaryDirectory() as tmp:
        out_path = Path(tmp) / 'graph.png'

        try:
            cli.graph.main([
                '--input-file',
                str(EXAMPLE_PATH / 'src' / 'states.c'),
                '--output-file',
                str(out_path),
            ])
        except SystemExit as ex:
            ex.code | should.be_equal(0)

        out_path.exists() | should.be_true()
Пример #8
0
def test_cli_build():
    with TemporaryDirectory() as tmp:
        out_path = Path(tmp) / 'test_states.cpp'
        base_path = Path(tmp) / 'base_states.cpp'

        copy(EXAMPLE_PATH / 'test' / 'base_states.cpp', base_path)

        try:
            cli.build.main([
                '--input-file',
                str(EXAMPLE_PATH / 'src' / 'states.c'),
                '--base-file',
                str(base_path),
                '--output-file',
                str(out_path),
            ])
        except SystemExit as ex:
            ex.code | should.be_equal(0)

        out_path.exists() | should.be_true()
Пример #9
0
 def test_is_enabled_func_in_an_user_that_matches_the_percentage(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     self.backend.add_functionality(func)
     self.backend.is_enabled(fn, "0") | should.be_true()
Пример #10
0
 def test_add_a_functionality_with_one_user(self):
     fn = "FOO"
     self.backend.add_functionality(Feature(fn, None, 0), ["bar"])
     self.backend.is_enabled(fn, "bar") | should.be_true()
Пример #11
0
 def test_is_enabled_func_in_an_user_that_matches_the_percentage(self):
     fn = "FOO"
     func = Feature(fn, None, 50)
     self.backend.add_functionality(func)
     self.backend.is_enabled(fn, "0") | should.be_true()
Пример #12
0
 def test_add_a_functionality_with_one_user(self):
     fn = "FOO"
     self.backend.add_functionality(Feature(fn, None, 0), ["bar"])
     self.backend.is_enabled(fn, "bar") | should.be_true()
Пример #13
0
def then_user_logged(_context):
    helpers.is_user_logged_in() | should.be_true("User should be logged in.")