Skip to content

Commit

Permalink
Helpful test cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Vest committed May 8, 2024
1 parent 2f727f0 commit c92060b
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions cmd/test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package main

import (
"context"
"fmt"
"os"

"github.com/linode/linodego"
)

func main() {

Check failure on line 11 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

Function 'main' is too long (66 > 60) (funlen)

Check failure on line 11 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

Function 'main' is too long (66 > 60) (funlen)
client, err := linodego.NewClientFromEnv(nil)
if err != nil {
fmt.Println(err)

Check failure on line 14 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Println` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

Check failure on line 14 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Println` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
os.Exit(1)
}

// Create Encrypted VM
encryptedLinode, err := client.CreateInstance(context.TODO(), linodego.InstanceCreateOptions{
Region: "us-east",
Type: "g6-standard-1",
Label: "encrypted",
// SET_ME_SECURELY
RootPass: "",
Image: "linode/debian12-kube-v1.28.3",
DiskEncryption: &linodego.InstanceDiskEncryptionEnabled,
})
if err != nil {
fmt.Println(err)

Check failure on line 29 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Println` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

Check failure on line 29 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Println` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
os.Exit(1)
}

fmt.Printf("%v\n", encryptedLinode)

Check failure on line 33 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

Check failure on line 33 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

unencryptedLinode, err := client.CreateInstance(context.TODO(), linodego.InstanceCreateOptions{
Region: "us-east",
Type: "g6-standard-1",
Label: "not",
// SET_ME_SECURELY
RootPass: "",
Image: "linode/debian12-kube-v1.28.3",
Tags: []string{"not"},
DiskEncryption: &linodego.InstanceDiskEncryptionDisabled,
})
if err != nil {
fmt.Println(err)

Check failure on line 46 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Println` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

Check failure on line 46 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Println` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
os.Exit(1)
}

fmt.Printf("%v\n", unencryptedLinode)

Check failure on line 50 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

Check failure on line 50 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

c, err := client.CreateLKECluster(context.TODO(), linodego.LKEClusterCreateOptions{
NodePools: []linodego.LKENodePoolCreateOptions{
{
Count: 1,
Type: "g6-standard-1",
Tags: []string{"linodego"},
DiskEncryption: &linodego.InstanceDiskEncryptionEnabled,
},
},
Label: "enabled2",
Region: "us-east",
K8sVersion: "1.28",
Tags: []string{"bingo"},
})
if err != nil {
fmt.Println(err)
os.Exit(1)
}

nodePools, err := client.ListLKENodePools(context.TODO(), c.ID, &linodego.ListOptions{})
if err != nil {
fmt.Println(err)
os.Exit(1)
}

fmt.Printf("%v", nodePools)

Check failure on line 77 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)

Check failure on line 77 in cmd/test.go

View workflow job for this annotation

GitHub Actions / lint-tidy

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
}

0 comments on commit c92060b

Please sign in to comment.