Skip to content

Commit

Permalink
AV-183200 Golang lint and TF tests failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohan-sss1 committed Jul 5, 2023
1 parent 6aa5d65 commit 28ce177
Show file tree
Hide file tree
Showing 38 changed files with 143 additions and 175 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Expand Up @@ -14,8 +14,8 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.48.0
args: --issues-exit-code=1
version: v1.53.3
args: run --issues-exit-code=1
only-new-issues: true
skip-pkg-cache: true
skip-build-cache: true
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Expand Up @@ -22,8 +22,8 @@ jobs:
name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.48.0
args: --issues-exit-code=1
version: v1.53.3
args: run --issues-exit-code=1
skip-pkg-cache: true
skip-build-cache: true
-
Expand Down
8 changes: 1 addition & 7 deletions .golangci.yml
Expand Up @@ -2,8 +2,7 @@ issues:
max-per-linter: 0
max-same-issues: 0
exclude:
- SA1019

- SA1019
run:
deadline: 5m
skip-files:
Expand All @@ -12,23 +11,18 @@ run:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gofmt
- goimports
- golint
- gosimple
- govet
- ineffassign
- interfacer
- nakedret
- misspell
- staticcheck
- structcheck
- typecheck
- unused
- unconvert
- varcheck
- vet
- vetshadow

Expand Down
4 changes: 2 additions & 2 deletions GNUmakefile
Expand Up @@ -9,11 +9,11 @@ build: fmtcheck

build13: GOOS=$(shell go env GOOS)
build13: GOARCH=$(shell go env GOARCH)
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(AVI_PROVIDER_NAMESPACE)/22.1.3/$(GOOS)_$(GOARCH)
build13: DESTINATION=$(HOME)/.terraform.d/plugins/$(AVI_PROVIDER_NAMESPACE)/30.1.1/$(GOOS)_$(GOARCH)
build13: fmtcheck
@echo "==> Installing plugin to $(DESTINATION)"
@mkdir -p $(DESTINATION)
go build -o $(DESTINATION)/terraform-provider-avi_v22.1.3
go build -o $(DESTINATION)/terraform-provider-avi_v30.1.1

test: fmtcheck
go test -i $(TEST) || exit 1
Expand Down
9 changes: 9 additions & 0 deletions avi/data_source_avi_applicationprofile_test.go
Expand Up @@ -92,6 +92,15 @@ resource "avi_applicationprofile" "testApplicationProfile" {
max_object_size = "4194304"
mime_types_group_refs = [data.avi_stringgroup.system_cacheablestringgroup.id]
}
http2_profile {
http2_initial_window_size = "64"
max_http2_concurrent_streams_per_connection = "128"
max_http2_control_frames_per_connection = "1000"
max_http2_empty_data_frames_per_connection = "1000"
max_http2_header_field_size = "4096"
max_http2_queued_frames_to_client_per_connection = "1000"
max_http2_requests_per_connection = "1000"
}
max_rps_unknown_uri = "0"
post_accept_timeout = "30000"
client_header_timeout = "10000"
Expand Down
2 changes: 1 addition & 1 deletion avi/data_source_avi_controllerproperties_test.go
Expand Up @@ -147,7 +147,7 @@ resource "avi_controllerproperties" "testControllerProperties" {
max_seq_attach_ip_failures = "3"
secure_channel_cleanup_timeout = "60"
vs_se_vnic_ip_fail = "120"
ssl_certificate_expiry_warning_days = ["30","7","1"]
ssl_certificate_expiry_warning_days = ["1","7","30"]
secure_channel_se_token_timeout = "60"
secure_channel_controller_token_timeout = "60"
api_idle_timeout = "15"
Expand Down
2 changes: 1 addition & 1 deletion avi/data_source_avi_customipamdnsprofile_test.go
Expand Up @@ -26,7 +26,7 @@ func TestAVIDataSourceCustomIpamDnsProfileBasic(t *testing.T) {

}

//nolint
// nolint
const testAccAVIDSCustomIpamDnsProfileConfig = `
data "avi_tenant" "default_tenant"{
name= "admin"
Expand Down
2 changes: 1 addition & 1 deletion avi/data_source_avi_dnspolicy_test.go
Expand Up @@ -26,7 +26,7 @@ func TestAVIDataSourceDnsPolicyBasic(t *testing.T) {

}

//nolint
// nolint
const testAccAVIDSDnsPolicyConfig = `
data "avi_tenant" "default_tenant"{
name= "admin"
Expand Down
2 changes: 1 addition & 1 deletion avi/data_source_avi_ipaddrgroup_test.go
Expand Up @@ -26,7 +26,7 @@ func TestAVIDataSourceIpAddrGroupBasic(t *testing.T) {

}

//nolint
// nolint
const testAccAVIDSIpAddrGroupConfig = `
data "avi_tenant" "default_tenant"{
name= "admin"
Expand Down
2 changes: 1 addition & 1 deletion avi/data_source_avi_ipamdnsproviderprofile_test.go
Expand Up @@ -28,7 +28,7 @@ func TestAVIDataSourceIpamDnsProviderProfileBasic(t *testing.T) {

}

//nolint
// nolint
const testAccAVIDSIpamDnsProviderProfileConfig = `
data "avi_tenant" "default_tenant"{
name= "admin"
Expand Down
10 changes: 5 additions & 5 deletions avi/data_source_avi_sslprofile_test.go
Expand Up @@ -42,7 +42,7 @@ resource "avi_sslprofile" "testSSLProfile" {
name = "test-System-Standard-abc"
tenant_ref = data.avi_tenant.default_tenant.id
ssl_session_timeout = "86400"
accepted_ciphers = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA"
accepted_ciphers = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384"
prefer_client_cipher_ordering = false
accepted_versions {
type = "SSL_VERSION_TLS1"
Expand All @@ -54,12 +54,12 @@ accepted_versions {
type = "SSL_VERSION_TLS1_2"
}
enable_ssl_session_reuse = true
cipher_enums = ["TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256","TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384","TLS_RSA_WITH_AES_128_GCM_SHA256","TLS_RSA_WITH_AES_256_GCM_SHA384","TLS_RSA_WITH_AES_128_CBC_SHA256","TLS_RSA_WITH_AES_256_CBC_SHA256","TLS_RSA_WITH_AES_128_CBC_SHA","TLS_RSA_WITH_AES_256_CBC_SHA","TLS_RSA_WITH_3DES_EDE_CBC_SHA","TLS_AES_256_GCM_SHA384","TLS_CHACHA20_POLY1305_SHA256","TLS_AES_128_GCM_SHA256"]
cipher_enums = ["TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_AES_256_GCM_SHA384","TLS_CHACHA20_POLY1305_SHA256","TLS_AES_128_GCM_SHA256"]
send_close_notify = true
ssl_rating {
performance_rating = "SSL_SCORE_EXCELLENT"
security_score = "100.0"
compatibility_rating = "SSL_SCORE_EXCELLENT"
performance_rating = "SSL_SCORE_NOT_SECURE"
security_score = "100"
compatibility_rating = "SSL_SCORE_GOOD"
}
dhparam = <<EOF
-----BEGIN DH PARAMETERS-----
Expand Down
4 changes: 4 additions & 0 deletions avi/datasource_avi_backupconfiguration.go
Expand Up @@ -59,6 +59,10 @@ func dataSourceAviBackupConfiguration() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"s3_bucket_folder": {
Type: schema.TypeString,
Computed: true,
},
"save_local": {
Type: schema.TypeString,
Computed: true,
Expand Down
2 changes: 1 addition & 1 deletion avi/datasource_avi_customipamdnsprofile.go
Expand Up @@ -5,7 +5,7 @@ package avi

import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

//nolint
// nolint
func dataSourceAviCustomIpamDnsProfile() *schema.Resource {
return &schema.Resource{
Read: ResourceAviCustomIpamDnsProfileRead,
Expand Down
2 changes: 1 addition & 1 deletion avi/datasource_avi_dnspolicy.go
Expand Up @@ -5,7 +5,7 @@ package avi

import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

//nolint
// nolint
func dataSourceAviDnsPolicy() *schema.Resource {
return &schema.Resource{
Read: ResourceAviDnsPolicyRead,
Expand Down
2 changes: 1 addition & 1 deletion avi/datasource_avi_dynamicdnsrecord.go
Expand Up @@ -5,7 +5,7 @@ package avi

import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

//nolint
// nolint
func dataSourceAviDynamicDnsRecord() *schema.Resource {
return &schema.Resource{
Read: ResourceAviDynamicDnsRecordRead,
Expand Down
2 changes: 1 addition & 1 deletion avi/datasource_avi_ipaddrgroup.go
Expand Up @@ -5,7 +5,7 @@ package avi

import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

//nolint
// nolint
func dataSourceAviIpAddrGroup() *schema.Resource {
return &schema.Resource{
Read: ResourceAviIpAddrGroupRead,
Expand Down
2 changes: 1 addition & 1 deletion avi/datasource_avi_ipamdnsproviderprofile.go
Expand Up @@ -5,7 +5,7 @@ package avi

import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

//nolint
// nolint
func dataSourceAviIpamDnsProviderProfile() *schema.Resource {
return &schema.Resource{
Read: ResourceAviIpamDnsProviderProfileRead,
Expand Down
20 changes: 10 additions & 10 deletions avi/provider.go
Expand Up @@ -315,8 +315,8 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
Tenant: "admin",
Version: "18.2.8",
AuthToken: d.Get("avi_authtoken").(string),
CSP_TOKEN: d.Get("avi_csp_token").(string),
CSP_HOST: d.Get("avi_csp_host").(string),
CSPToken: d.Get("avi_csp_token").(string),
CSPHost: d.Get("avi_csp_host").(string),
Timeout: time.Duration(d.Get("avi_api_timeout").(int)) * time.Second,
}
if username, ok := d.GetOk("avi_username"); ok {
Expand All @@ -332,11 +332,11 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
if timeout, ok := d.GetOk("avi_api_timeout"); ok {
config.Timeout = time.Duration(timeout.(int)) * time.Second
}
if Csp_token, ok := d.GetOk("avi_csp_token"); ok {
config.CSP_TOKEN = Csp_token.(string)
if csptoken, ok := d.GetOk("avi_csp_token"); ok {
config.CSPToken = csptoken.(string)
}
if Csp_host, ok := d.GetOk("avi_csp_host"); ok {
config.CSP_HOST = Csp_host.(string)
if csphost, ok := d.GetOk("avi_csp_host"); ok {
config.CSPHost = csphost.(string)
}

aviClient, err := clients.NewAviClient(
Expand All @@ -346,8 +346,8 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
session.SetVersion(config.Version),
session.SetAuthToken(config.AuthToken),
session.SetInsecure, session.SetTimeout(config.Timeout),
session.SetCSPHost(config.CSP_HOST),
session.SetCSPToken(config.CSP_TOKEN),
session.SetCSPHost(config.CSPHost),
session.SetCSPToken(config.CSPToken),
session.SetLazyAuthentication(true))

log.Printf("Avi Client created for user %s tenant %s version %s\n",
Expand All @@ -363,7 +363,7 @@ type Credentials struct {
Tenant string
Version string
AuthToken string
CSP_HOST string
CSP_TOKEN string
CSPHost string
CSPToken string
Timeout time.Duration
}
18 changes: 18 additions & 0 deletions avi/resource_avi_applicationprofile_test.go
Expand Up @@ -160,6 +160,15 @@ resource "avi_applicationprofile" "testApplicationProfile" {
max_object_size = "4194304"
mime_types_group_refs = [data.avi_stringgroup.system_cacheablestringgroup.id]
}
http2_profile {
http2_initial_window_size = "64"
max_http2_concurrent_streams_per_connection = "128"
max_http2_control_frames_per_connection = "1000"
max_http2_empty_data_frames_per_connection = "1000"
max_http2_header_field_size = "4096"
max_http2_queued_frames_to_client_per_connection = "1000"
max_http2_requests_per_connection = "1000"
}
max_rps_unknown_uri = "0"
post_accept_timeout = "30000"
client_header_timeout = "10000"
Expand Down Expand Up @@ -239,6 +248,15 @@ resource "avi_applicationprofile" "testApplicationProfile" {
max_object_size = "4194304"
mime_types_group_refs = [data.avi_stringgroup.system_cacheablestringgroup.id]
}
http2_profile {
http2_initial_window_size = "64"
max_http2_concurrent_streams_per_connection = "128"
max_http2_control_frames_per_connection = "1000"
max_http2_empty_data_frames_per_connection = "1000"
max_http2_header_field_size = "4096"
max_http2_queued_frames_to_client_per_connection = "1000"
max_http2_requests_per_connection = "1000"
}
max_rps_unknown_uri = "0"
post_accept_timeout = "30000"
client_header_timeout = "10000"
Expand Down
5 changes: 5 additions & 0 deletions avi/resource_avi_backupconfiguration.go
Expand Up @@ -80,6 +80,11 @@ func ResourceBackupConfigurationSchema() map[string]*schema.Schema {
Optional: true,
Computed: true,
},
"s3_bucket_folder": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"save_local": {
Type: schema.TypeString,
Optional: true,
Expand Down
4 changes: 2 additions & 2 deletions avi/resource_avi_controllerproperties_test.go
Expand Up @@ -266,7 +266,7 @@ resource "avi_controllerproperties" "testControllerProperties" {
max_seq_attach_ip_failures = "3"
secure_channel_cleanup_timeout = "60"
vs_se_vnic_ip_fail = "120"
ssl_certificate_expiry_warning_days = ["30","7","1"]
ssl_certificate_expiry_warning_days = ["1","7","30"]
secure_channel_se_token_timeout = "60"
secure_channel_controller_token_timeout = "60"
api_idle_timeout = "15"
Expand Down Expand Up @@ -314,7 +314,7 @@ resource "avi_controllerproperties" "testControllerProperties" {
max_seq_attach_ip_failures = "3"
secure_channel_cleanup_timeout = "60"
vs_se_vnic_ip_fail = "120"
ssl_certificate_expiry_warning_days = ["30","7","1"]
ssl_certificate_expiry_warning_days = ["1","7","30"]
secure_channel_se_token_timeout = "60"
secure_channel_controller_token_timeout = "60"
api_idle_timeout = "15"
Expand Down
14 changes: 7 additions & 7 deletions avi/resource_avi_customipamdnsprofile.go
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/vmware/alb-sdk/go/clients"
)

//nolint
// nolint
func ResourceCustomIpamDnsProfileSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"configpb_attributes": {
Expand Down Expand Up @@ -46,7 +46,7 @@ func ResourceCustomIpamDnsProfileSchema() map[string]*schema.Schema {
}
}

//nolint
// nolint
func resourceAviCustomIpamDnsProfile() *schema.Resource {
return &schema.Resource{
Create: resourceAviCustomIpamDnsProfileCreate,
Expand All @@ -60,13 +60,13 @@ func resourceAviCustomIpamDnsProfile() *schema.Resource {
}
}

//nolint
// nolint
func ResourceCustomIpamDnsProfileImporter(d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) {
s := ResourceCustomIpamDnsProfileSchema()
return ResourceImporter(d, m, "customipamdnsprofile", s)
}

//nolint
// nolint
func ResourceAviCustomIpamDnsProfileRead(d *schema.ResourceData, meta interface{}) error {
s := ResourceCustomIpamDnsProfileSchema()
err := APIRead(d, meta, "customipamdnsprofile", s)
Expand All @@ -76,7 +76,7 @@ func ResourceAviCustomIpamDnsProfileRead(d *schema.ResourceData, meta interface{
return err
}

//nolint
// nolint
func resourceAviCustomIpamDnsProfileCreate(d *schema.ResourceData, meta interface{}) error {
s := ResourceCustomIpamDnsProfileSchema()
err := APICreateOrUpdate(d, meta, "customipamdnsprofile", s)
Expand All @@ -86,7 +86,7 @@ func resourceAviCustomIpamDnsProfileCreate(d *schema.ResourceData, meta interfac
return err
}

//nolint
// nolint
func resourceAviCustomIpamDnsProfileUpdate(d *schema.ResourceData, meta interface{}) error {
s := ResourceCustomIpamDnsProfileSchema()
var err error
Expand All @@ -97,7 +97,7 @@ func resourceAviCustomIpamDnsProfileUpdate(d *schema.ResourceData, meta interfac
return err
}

//nolint
// nolint
func resourceAviCustomIpamDnsProfileDelete(d *schema.ResourceData, meta interface{}) error {
objType := "customipamdnsprofile"
client := meta.(*clients.AviClient)
Expand Down

0 comments on commit 28ce177

Please sign in to comment.