Skip to content

Design K8sClient abstract interface that will abstract underlying calls #355

@hattan

Description

@hattan

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions