Skip to content

AV-183200 Golang lint and TF tests failure #555

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

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.48.0
version: v1.53.3
args: --issues-exit-code=1
only-new-issues: true
skip-pkg-cache: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the deadcode.

Copy link
Collaborator Author

@Rohan-sss1 Rohan-sss1 Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parimanur they have deprecated this from the linters but by default they are executing this internally.
golangci/golangci-lint#3125

- 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading