I am trying a sample application, I first added the to connect to SQS, SNS and ElasticSearch
@ExtendWith(LocalstackExtension.class)
@LocalstackDockerProperties(services = {"sqs", "sns", "elasticsearch"}, randomizePorts = true)
class MyAppApplicationTests {
@Test
void contextLoads() {
AmazonSQS sqs = TestUtils.getClientSQS();
AmazonSNS sns = TestUtils.getClientSNS();
}
}
2020-01-06 17:49:21.899 INFO 20484 --- [ main] cloud.localstack.deprecated.Localstack : /tmp/localstack_install_dir
2020-01-06 17:49:21.899 INFO 20484 --- [ main] cloud.localstack.deprecated.Localstack : Waiting for infrastructure to be spun up
java.lang.RuntimeException: Unable to start local infrastructure. Debug output: make: Entering directory '/tmp/localstack_install_dir'
(. .venv/bin/activate; exec bin/localstack start --host)
Starting local dev environment. CTRL-C to quit.
ERROR: 'cd /tmp/localstack_install_dir/localstack; npm install https://github.com/whummer/serverless-iot-offline': exit code 127; output: /bin/sh: 1: npm: not found
ERROR: 'cd "/tmp/localstack_install_dir/localstack" && npm install': exit code 127; output: /bin/sh: 1: npm: not found
Error starting infrastructure: Command 'cd "/tmp/localstack_install_dir/localstack" && npm install' returned non-zero exit status 127. Traceback (most recent call last):
File "/tmp/localstack_install_dir/localstack/services/infra.py", line 432, in start_infra
install.install_components(apis)
File "/tmp/localstack_install_dir/localstack/services/install.py", line 210, in install_components
parallelize(install_component, names)
File "/tmp/localstack_install_dir/localstack/utils/common.py", line 1090, in parallelize
result = pool.map(func, list)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 253, in map
return self.map_async(func, iterable, chunksize).get()
File "/usr/lib/python2.7/multiprocessing/pool.py", line 572, in get
raise self._value
CalledProcessError: Command 'cd "/tmp/localstack_install_dir/localstack" && npm install' returned non-zero exit status 127.
ERROR: Command 'cd "/tmp/localstack_install_dir/localstack" && npm install' returned non-zero exit status 127.
Makefile:47: recipe for target 'infra' failed
make: Leaving directory '/tmp/localstack_install_dir'
md5-c68e4b259b359983d2cd3a8577d32546
Jan 06, 2020 5:55:17 PM cloud.localstack.deprecated.Localstack ensureInstallation
INFO: Installing LocalStack to temporary directory (this may take a while): /tmp/localstack_install_dir
java.lang.RuntimeException: java.lang.IllegalStateException: Failed to run command 'bash -c cd "/tmp/localstack_install_dir"; make install', return code 2.
STDOUT: make setup-venv && \
(test ! -e requirements.txt || (. .venv/bin/activate; pip -q install -r requirements.txt && \
PYTHONPATH=. exec python localstack/services/install.py testlibs)) || exit 1
make[1]: Entering directory '/tmp/localstack_install_dir'
(test `which virtualenv` || pip install --user virtualenv) && \
(test -e .venv || virtualenv .venv)
Makefile:14: recipe for target 'setup-venv' failed
make[1]: Leaving directory '/tmp/localstack_install_dir'
Makefile:18: recipe for target 'install' failed
STDERR: /bin/sh: 2: virtualenv: not found
make[1]: *** [setup-venv] Error 127
make: *** [install] Error 1
I have localstack installed in /tmp/localstack, it works fine on the command line, should I try to use it as the root dir?
Help me localstack gods.
Thanks for reporting @lpegoraro . It looks like you're using the old installation mechanism which attempts to install the LocalStack components on the local machine, instead of running in Docker. This method is now deprecated, and has been replaced in favor of running in Docker.
Which version of the Java libs are you using? I believe this should be fixed in the latest version (0.2.0). You'll note that LocalstackExtension is now located under a deprecated package. Please use @RunWith(LocalstackTestRunner.class) instead, see the examples in the README here: https://github.com/localstack/localstack#integration-with-javajunit
Hope that helps - please re-open this issue or report here if the problem persists. Thanks!
Hi, I just solved it.
I did the following
@ExtendWith(LocalstackDockerExtension.class)
@LocalstackDockerProperties(services = {"sqs", "sns", "es"})
Thanks!
@whummer We experienced this same issue due to a combination the documentation needing updated and LocalstackExtension not being marked as deprecated. I opened a PR. Can we reopen this issue for the PR or would you prefer I create a new issue?
Most helpful comment
@whummer We experienced this same issue due to a combination the documentation needing updated and
LocalstackExtensionnot being marked as deprecated. I opened a PR. Can we reopen this issue for the PR or would you prefer I create a new issue?