Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design K8sClient abstract interface that will abstract underlying calls #355

Open
hattan opened this issue Oct 3, 2023 · 1 comment
Open

Comments

@hattan
Copy link
Contributor

hattan commented Oct 3, 2023

The goal of this design is to create a proposal for a high level abstraction for use in writing tests against Kubernetes in Benchpress.

Parent: #353

Initial spike:

BeforeAll {
  Import-Module BenchPress.Kubernetes

}

Describe 'Verify Pods' {
  It "Should contain 5 pods, when a kubeconfig is explicitly provided" {
    # arrange
    $params = @{
      KubeConfigFile     = "<path>"
    }

    $pods = Get-Pods $params

    # act and assert
    $pods.length | Should -Be 5
  }

  It "Should contain 5 pods, when the environment variable KUBECONFIG is set" {
    # arrange
    $Env:KUBECONFIG = "<path to kubeconfig file"

    $pods = Get-Pods 

    # act and assert
    $pods.length | Should -Be 5
  }  

  It "Should contain 5 pods and use the default kubeconfig when no file or environment variable is set" {
    # arrange

    # should use the default kubeconfig
    $pods = Get-Pods 

    # act and assert
    $pods.length | Should -Be 5
  }    
}

AfterAll {
  Get-Module BenchPress.Kubernetes | Remove-Module
}
@hattan
Copy link
Contributor Author

hattan commented Oct 3, 2023

Implementation should create a KubernetesClient object under the hood and have different implementations for either a kubectl implementation or one using the dotnet sdk.

To level functions shouldn't call the KubernetesClient directly as it will be a private implementation method (Similar to BenchPress's Account module)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant