Skip to content

Commit

Permalink
Fix a Data.Yaml deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Jun 18, 2024
1 parent daf54bf commit f2b0fa5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kubernetes-client/kubernetes-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ test-suite spec
, tls >=1.4.1
, typed-process >=0.2
, uri-bytestring >=0.3
, yaml
, yaml >=0.8.4
default-language: Haskell2010
if impl(ghc >= 9.6)
build-depends:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-client/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tests:
- hspec
- hspec-attoparsec
- hspec-megaparsec
- yaml
- yaml >= 0.8.4
- file-embed
example:
main: App.hs
Expand Down
8 changes: 5 additions & 3 deletions kubernetes-client/test/Kubernetes/Client/KubeConfigSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module Kubernetes.Client.KubeConfigSpec where

import Data.Aeson (decode, encode, parseJSON,
toJSON)
import Data.Maybe (fromJust)
import Data.Yaml (decodeFile)
import Data.Either (fromRight)
import Data.Yaml (decodeFileEither)
import Kubernetes.Client.KubeConfig (AuthInfo (..), Cluster (..),
Config, Context (..),
getAuthInfo, getCluster,
Expand All @@ -15,11 +15,13 @@ import Test.Hspec
spec :: Spec
spec = do
let getConfig :: IO Config
getConfig = fromJust <$> decodeFile "test/testdata/kubeconfig.yaml"
getConfig = fromRight (error "Couldn't decode config") <$> decodeFileEither "test/testdata/kubeconfig.yaml"

describe "FromJSON and ToJSON instances" $ do
it "roundtrips successfully" $ do
config <- getConfig
decode (encode (toJSON config)) `shouldBe` Just config

describe "getContext" $ do
it "returns the correct context" $ do
config <- getConfig
Expand Down

0 comments on commit f2b0fa5

Please sign in to comment.