Working on upgrading an app from using Flutter SDK 2.0.6 to 2.8.1. Updated all the tests so that they pass locally on Intel Macbook Pro. Upgraded the docker image our CircleCI server uses to point to use the new SDK. The docker file looks like:
FROM circleci/android:api-30
RUN sudo apt-get install -y locales
RUN sudo dpkg-reconfigure locales
RUN /usr/sbin/locale-gen C.UTF-8
ENV LANG='C.UTF-8' LC_ALL='C.UTF-8'
RUN curl https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_2.8.1-stable.tar.xz -o /tmp/flutter.tar.xz && \
sudo tar -xvJ -C /opt -f /tmp/flutter.tar.xz && \
sudo chown -R circleci:circleci /opt/flutter && \
rm -f /tmp/flutter.tar.xz
ENV PATH="${PATH}:/opt/flutter/bin"
Now some of the unit tests on the CI server fail with the following error:
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following SocketException was thrown running a test:
Connection failed (OS Error: No such file or directory, errno = 2), address =
/var/run/dbus/system_bus_socket, port = 0
When the exception was thrown, this was the stack:
#0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:681:35)
I'm a little out of my depth with running flutter in a CI server. What does that error mean, and what steps can I take to troubleshoot?
Later on in the stack trace it is ConnectivityLinux._startListenConnectivity (package:connectivity_plus_linux/src/connectivity.dart:61:20)
It turns out I needed to pass in a mocked connectionStream in my tests.
Related
I am on Ubuntu 22.04.1 and I am trying to start Bridge to Kubernetes in Visual Studio Code v1.74.3.
However, it would hang for a few seconds on the "Waiting for the EndpointManager to come up..." step, and then crash with an uninformative error log:
Error: connect-service-task-terminal-error <json>{}</json> <stack>Error: Failed to establish a connection.
Error: An unexpected error occurred: 'Failed to launch EndpointManager.'\n
To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.\n
For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.\n\n
I have tried setting an environmental variable as suggested in this GitHub issue thread, but it did not do it for me.
BRIDGE_BINARYUTILITYVERSION=v1
My colleague assumed, that since the Bridge to Kubernetes uses dotnet under the hood, it is worth trying installing dotnet SDK and dotnet environment separately, which fixed the issue for me.
First the dotnet SDK:
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-6.0
And the dotnet runtime:
sudo apt-get update && \
sudo apt-get install -y aspnetcore-runtime-6.0
I'm trying to run integration tests for a Linux desktop application in a Docker container.
I have a working project, running successful integration tests on Linux device.
I created a Docker image from the following Dockerfile content:
FROM cirrusci/flutter:stable
RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get -y install --no-install-recommends unzip pkg-config clang cmake ninja-build libgtk-3-dev libappindicator1 fonts-liberation gpg-agent libxi6 libgconf-2-4 && \
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && apt-get -y install google-chrome-stable && \
CHROMEVER=$(google-chrome --product-version | grep -o "[^\.]*\.[^\.]*\.[^\.]*") && \
DRIVERVER=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEVER") && \
wget -q --continue -P /chromedriver "http://chromedriver.storage.googleapis.com/$DRIVERVER/chromedriver_linux64.zip" && \
unzip /chromedriver/chromedriver* -d /chromedriver && \
rm -rf /var/lib/apt/lists/*
ENV PATH $CHROMEDRIVER_DIR:$PATH
I'm not sure I need Chrome and Chromedriver for my usecase, but at least it's here.
When running "flutter doctor" from this image, I get:
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel unknown, 3.3.8, on Ubuntu 22.04 LTS 5.15.0-53-generic, locale en_US.UTF-8)
! Flutter version 3.3.8 on channel unknown at /sdks/flutter
! Upstream repository unknown
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 2 categories.
which seems quite OK.
However when running my integration tests, attempting to give access to my local X server (I'm using Ubuntu 22.04 on Wayland):
docker run --rm -it -v ${PWD}:/workspace --privileged -w /workspace -e DISPLAY="unix:0" -v /tmp/.X11-unix:/tmp/.X11-unix flutter:local /bin/sh -c "flutter clean && flutter test integration_test"
The tests fail with:
Deleting build... 14ms
Deleting .dart_tool... 3ms
Deleting ephemeral... 3ms
Deleting ephemeral... 0ms
Deleting ephemeral... 0ms
Deleting .flutter-plugins-dependencies... 0ms
Deleting .flutter-plugins... 0ms
Downloading Web SDK... 1,658ms
Downloading CanvasKit... 1,084ms
Downloading linux-x64/linux-x64-flutter-gtk tools... 1,090ms
Downloading linux-x64-profile/linux-x64-flutter-gtk tools... 156ms
Downloading linux-x64-release/linux-x64-flutter-gtk tools... 124ms
Running "flutter pub get" in workspace... 1,498ms
00:00 +0: loading /workspace/integration_test/main_test.dart B00:07 +0: loading /workspace/integration_test/main_test.dart
Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
00:07 +0 -1: loading /workspace/integration_test/main_test.dart [E]
TestDeviceException(Unable to start the app on the device.)
package:flutter_tools/src/test/integration_test_device.dart 60:7 IntegrationTestTestDevice.start
To run this test again: /sdks/flutter/bin/cache/dart-sdk/bin/dart test /workspace/integration_test/main_test.dart -p vm --plain-name 'loading /workspace/integration_test/main_test.dart'
00:07 +0 -1: Some tests failed.
Adding verbose to the test does not give much better than TestDeviceException(Unable to start the app on the device.)
I tried many things but I can't get it to work, and I can't find a lot of documentation on integration tests for desktop applications on Flutter, only on web applications, which is easier with headless Chrome.
If anyone has any hint about what could be wrong, I'd love it. Otherwise, I'll make my CI/CD run in shell mode on a non-headless VM instead of Docker, which I'd prefer not to.
I'm developing a new IoT Agent according to https://iotagent-node-lib.readthedocs.io/en/latest/howto/index.html
and I'm trying to run the following code: node index.js
but a warning shows up: (node:6176) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
DEP0097 - Deprecation Warning (NODE.JS)
Any suggestions how to solve it?
thank you!
It appears that you are running your IoT Agent under Node 14. The Domain API has been deprecated and this is the cause of your warning. There is code within the IoT Agent Node lib currently uses the Domain API for communications with Telefonica Steelskin.
The IoT Agents are tested against LTS node releases, (currently 10 and 12 see here) and Node 14 doesn't hit LTS until October 2020, so I would expect an interim release should fix the issue.
In the meantime if you run your agent under an earlier version of Node - for example via Docker. An example can be found in the Custom IoT Agent tutorial Dockerfile
ARG NODE_VERSION=10.17.0-slim
FROM node:${NODE_VERSION}
COPY . /opt/iotXML/
WORKDIR /opt/iotXML
RUN \
apt-get update && \
apt-get install -y git && \
npm install pm2#3.2.2 -g && \
echo "INFO: npm install --production..." && \
npm install --production && \
# Remove Git and clean apt cache
apt-get clean && \
apt-get remove -y git && \
apt-get -y autoremove && \
chmod +x docker/entrypoint.sh
USER node
ENV NODE_ENV=production
# Expose 4041 for NORTH PORT, 7896 for HTTP PORT
EXPOSE ${IOTA_NORTH_PORT:-4041} ${IOTA_HTTP_PORT:-7896}
ENTRYPOINT ["docker/entrypoint.sh"]
CMD ["-- ", "config.js"]
The node version can be altered by adding NODE_VERSION to the Docker build command when building the Docker container.
The problem has to do with docker for windows toolbox. I installed linux and the custom iot agent worked. I think the problem ocurred because of the environment variables. For some reason windows 10 doesn't initiate .env archive variables that exist in the project.
I am facing problem while running the Salesforce trailhead tutorial - RecordViewer app on my Ubuntu 18.04 machine on Docker. Trailhead tutorial is available the this link ( https://trailhead.salesforce.com/en/content/learn/modules/user-interface-api/install-sample-app?trail_id=force_com_dev_intermediate )
Complete APP code is available on git at link -
https://github.com/forcedotcom/RecordViewer
**Also the app is running good after the fresh install of Docker 18.09.9 version. However, when i restart the machine, I am gettting the below error -
(
$ docker-compose build && docker-compose up -d
Building web
Step 1/7 : FROM node:8.9.3
---> 2eeae8debf3d
Step 2/7 : WORKDIR /usr/src/app
---> Using cache
---> 6d3cbee274e4
Step 3/7 : COPY package*.json ./
---> Using cache
---> 8d4dc1aebcb8
Step 4/7 : RUN npm install
---> Running in 29f377439948
fs.js:646
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EACCES: permission denied, open '/usr/local/lib/node_modules/npm/bin/npm-cli.js'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.Module._extensions..js (module.js:645:20)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
ERROR: Service 'web' failed to build: The command '/bin/sh -c npm install' returned a non-zero code: 1
)
**RecordViewer App - is a nodejs, react app using salesforce User Interface API
Let me explain what i did -
I have installed the latest Docker version on my machine but due to some library incompatibality couldn't run the app.
So I installed docker 18.09.9 version on my ubuntu machine. docker is installed perfectly and running the hello-world program.
After installing and using terminal from the project directory run the below command and the app got running well-
$ docker-compose build && docker-compose up -d
When I restart the machine I am unable to run the App.
I have tried alot, seached every where but could not find the solution.
Below is the docker version installed in my machine-
$ docker version
Client:
Version: 18.09.9
API version: 1.39
Go version: go1.11.13
Git commit: 039a7df9ba
Built: Wed Sep 4 16:57:28 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.09.9
API version: 1.39 (minimum version 1.12)
Go version: go1.13.4
Git commit: 9552f2b
Built: Sat Nov 16 01:07:48 2019
OS/Arch: linux/amd64
Experimental: false
It seems some sort of permission issue but i have tried giving all rights to current user on /usr/local/ directory.
Any help will be great.
Thanks,
Brij
I am not sure about exact problem but think it was some sort of permission issue. I tried alot giving all permissions to various directories. Finally my ubuntu crashed giving wierd black screen. I had to reinstall Ubunut 18.04 in my machine. Now I have installed docker version 19.03.11 following the installation guide on docker website. the project run with the command $ docker-compose build && docker-compose up -d.
I followed the below mentioned steps-
// installation link - https://docs.docker.com/engine/install/ubuntu/
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
//add official key of docker
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
//as latest version was not working I install below version
//installing version - 5:18.09.9~3-0~ubuntu-bionic
$ sudo apt-get install docker-ce=5:18.09.9~3-0~ubuntu-bionic docker-ce-cli=5:18.09.9~3-0~ubuntu-bionic containerd.io
// Install Docker Compose.
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
// give executable rights
$ sudo chmod +x /usr/local/bin/docker-compose
//create a symbolic link to /usr/bin
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
### Running Project trailhead ##
---------------------------------
// run the project from the folder
$ docker-compose build && docker-compose up -d
//if above command giving error
// add self user to docker group
$ usermod -aG docker ${USER}
// check status
$ sudo systemctl status docker.service -l
// If still givving error then try this.
$ docker-compose --verbose up
I got it running after following above steps.
When I build a image using docker for an existing application I got one error like connection failed and
E: Some index files failed to download. They have been ignored, or old
ones used instead.
The command
/bin/sh -c apt-get -y update && apt-get install -y --no-install-recommends wget python nginx ca-certificates && rm -rf /var/lib/apt/lists/*
returned a non-zero code: 100.
E: Failed to fetch
http://archive.ubuntu.com/ubuntu/dists/xenial-backports/main/binary-amd64/Packages
Connection failed [IP]
I tried the following:
1) Proxy settings of Environment variable.
2) set experimental = true in Docker settings.
3) added my username in both docker user list and Hyper - v list.
but not yet to solve the issue.
Can you please some one help me to solve this error?