Skip to content

Commit

Permalink
Merge pull request #162 from agorapulse/bug/localstack-env-keys-hyphened
Browse files Browse the repository at this point in the history
prevent hyphening keys in the localstack.env.* configuration map
  • Loading branch information
wololock authored Apr 5, 2023
2 parents 1783b17 + 31e7814 commit b0b74bb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
*/
package com.agorapulse.micronaut.amazon.awssdk.itest.localstack;

import io.micronaut.core.convert.format.MapFormat;
import io.micronaut.core.naming.conventions.StringConvention;

import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -55,7 +58,7 @@ public Map<String, String> getEnv() {
return env;
}

public void setEnv(Map<String, String> env) {
public void setEnv(@MapFormat(keyFormat = StringConvention.RAW) Map<String, String> env) {
this.env = env;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2018-2023 Agorapulse.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agorapulse.micronaut.amazon.awssdk.itest.localstack

import io.micronaut.context.annotation.Property
import io.micronaut.test.annotation.MicronautTest
import spock.lang.Specification

import javax.inject.Inject

@MicronautTest
@Property(name = 'localstack.env.DEBUG', value = '1')
@Property(name = 'localstack.env.LAMBDA_EXECUTOR', value = 'local')
class LocalstackContainerConfigurationSpec extends Specification {

@Inject LocalstackContainerConfiguration configuration

void 'env map should not apply hyphenated conversion to the key values'() {
expect:
configuration.env.get('DEBUG') == '1'
configuration.env.get('LAMBDA_EXECUTOR') == 'local'
}

}

0 comments on commit b0b74bb

Please sign in to comment.