• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

binbashar / leverage / 11988849192

23 Nov 2024 04:54PM UTC coverage: 60.428% (+0.4%) from 60.037%
11988849192

Pull #281

github

Franr
testing discover happy path
Pull Request #281: [BV-599] Kubeconfig helper

194 of 458 branches covered (42.36%)

Branch coverage included in aggregate %.

52 of 72 new or added lines in 4 files covered. (72.22%)

46 existing lines in 5 files now uncovered.

2518 of 4030 relevant lines covered (62.48%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.41
/leverage/modules/kubectl.py
1
from leverage._internals import pass_state
1✔
2
from leverage._internals import pass_container
1✔
3
from leverage.container import get_docker_client
1✔
4
from leverage.containers.kubectl import KubeCtlContainer
1✔
5

6
import click
1✔
7

8
from leverage.modules.utils import _handle_subcommand
1✔
9

10
CONTEXT_SETTINGS = {"ignore_unknown_options": True}
1✔
11

12

13
@click.group(invoke_without_command=True, context_settings={"ignore_unknown_options": True})
1✔
14
@click.argument("args", nargs=-1, type=click.UNPROCESSED)
1✔
15
@pass_state
1✔
16
@click.pass_context
1✔
17
def kubectl(context, state, args):
1✔
18
    """Run Kubectl commands in a custom containerized environment."""
19
    state.container = KubeCtlContainer(get_docker_client())
×
20
    state.container.ensure_image()
×
21
    _handle_subcommand(context=context, cli_container=state.container, args=args)
×
22

23

24
@kubectl.command(context_settings=CONTEXT_SETTINGS)
1✔
25
@pass_container
1✔
26
def shell(kctl: KubeCtlContainer):
1✔
27
    """Spawn a shell with the kubectl credentials pre-configured."""
NEW
28
    kctl.paths.check_for_layer_location()
×
UNCOV
29
    kctl.start_shell()
×
30

31

32
@kubectl.command(context_settings=CONTEXT_SETTINGS)
1✔
33
@pass_container
1✔
34
def configure(kctl: KubeCtlContainer):
1✔
35
    """Automatically add the EKS cluster from the layer into your kubectl config file."""
NEW
36
    kctl.paths.check_for_cluster_layer()
×
UNCOV
37
    kctl.configure()
×
38

39

40
@kubectl.command(context_settings=CONTEXT_SETTINGS)
1✔
41
@pass_container
1✔
42
def discover(kctl: KubeCtlContainer):
1✔
NEW
43
    kctl.discover()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc