mirror of
https://github.com/hashicorp/packer.git
synced 2025-12-18 23:16:06 -05:00
The global `PACKER_CONFIG` config file was already deprecated from Packer core, but now with 1.11.0 since we remove support for mono-component plugins, we are also removing the capability for that config file to declare them. Instead of silently not using those, Packer will now error with a message pointing to the web docs on how to manage their plugins with the updated workflows for Packer 1.11 and above.
38 lines
805 B
Go
38 lines
805 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDecodeConfig(t *testing.T) {
|
|
|
|
packerConfig := `
|
|
{
|
|
"PluginMinPort": 10,
|
|
"PluginMaxPort": 25,
|
|
"disable_checkpoint": true,
|
|
"disable_checkpoint_signature": true,
|
|
"provisioners": {
|
|
"super-shell": "packer-provisioner-super-shell"
|
|
}
|
|
}`
|
|
|
|
var cfg config
|
|
err := decodeConfig(strings.NewReader(packerConfig), &cfg)
|
|
if err != nil {
|
|
t.Fatalf("error encountered decoding configuration: %v", err)
|
|
}
|
|
|
|
var expectedCfg config
|
|
json.NewDecoder(strings.NewReader(packerConfig)).Decode(&expectedCfg)
|
|
if !reflect.DeepEqual(cfg, expectedCfg) {
|
|
t.Errorf("failed to load custom configuration data; expected %v got %v", expectedCfg, cfg)
|
|
}
|
|
|
|
}
|