Skip to content

Commit e109473

Browse files
authored
Revert "Functional Test (#439)"
This reverts commit 68b7e21.
1 parent 68b7e21 commit e109473

31 files changed

+804
-393
lines changed

.coveragerc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ source = ./libraries/
33
omit =
44
*/tests/*
55
setup.py
6-
*/botbuilder-schema/*
7-
*/functional-tests/*
6+
*/botbuilder-schema/*

azure-pipelines.yml

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,61 @@
1-
schedules:
2-
- cron: "0 0 * * *"
3-
displayName: Daily midnight build
1+
trigger:
42
branches:
53
include:
4+
- daveta-python-functional
5+
exclude:
66
- master
77

88
variables:
9-
resourceGroupName: 'pyfuntest'
9+
# Container registry service connection established during pipeline creation
10+
dockerRegistryServiceConnection: 'NightlyE2E-Acr'
11+
azureRmServiceConnection: 'NightlyE2E-RM'
12+
dockerFilePath: 'libraries/functional-tests/functionaltestbot/Dockerfile'
13+
buildIdTag: $(Build.BuildNumber)
14+
webAppName: 'e2epython'
15+
containerRegistry: 'nightlye2etest.azurecr.io'
16+
imageRepository: 'functionaltestpy'
17+
18+
19+
1020

1121
jobs:
12-
- job: Doit
22+
# Build and publish container
23+
- job: Build
1324
pool:
1425
vmImage: 'Ubuntu-16.04'
15-
26+
displayName: Build and push bot image
27+
continueOnError: false
1628
steps:
17-
- task: UsePythonVersion@0
18-
displayName: Use Python 3.6
29+
- task: Docker@2
30+
displayName: Build and push bot image
1931
inputs:
20-
versionSpec: '3.6'
32+
command: buildAndPush
33+
repository: $(imageRepository)
34+
dockerfile: $(dockerFilePath)
35+
containerRegistry: $(dockerRegistryServiceConnection)
36+
tags: $(buildIdTag)
37+
38+
2139

22-
- task: AzureCLI@2
23-
displayName: Provision, Deploy and run tests
40+
- job: Deploy
41+
displayName: Provision bot container
42+
pool:
43+
vmImage: 'Ubuntu-16.04'
44+
dependsOn:
45+
- Build
46+
steps:
47+
- task: AzureRMWebAppDeployment@4
48+
displayName: Python Functional E2E test.
2449
inputs:
25-
azureSubscription: 'FUSE Temporary (174c5021-8109-4087-a3e2-a1de20420569)'
26-
scriptType: 'bash'
27-
scriptLocation: 'inlineScript'
28-
inlineScript: |
29-
cd $(Build.SourcesDirectory)/libraries/functional-tests/functionaltestbot
30-
chmod +x ./scripts/deploy_webapp.sh
31-
./scripts/deploy_webapp.sh --appid $(botAppId) --password $(botAppPassword) -g $(resourceGroupName)
32-
continueOnError: false
50+
ConnectionType: AzureRM
51+
ConnectedServiceName: $(azureRmServiceConnection)
52+
appType: webAppContainer
53+
WebAppName: $(webAppName)
54+
DockerNamespace: $(containerRegistry)
55+
DockerRepository: $(imageRepository)
56+
DockerImageTag: $(buildIdTag)
57+
AppSettings: '-MicrosoftAppId $(botAppId) -MicrosoftAppPassword $(botAppPassword) -FLASK_APP /functionaltestbot/app.py -FLASK_DEBUG 1'
58+
59+
#StartupCommand: 'flask run --host=0.0.0.0 --port=3978'
60+
61+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
FROM tiangolo/uwsgi-nginx-flask:python3.6
5+
6+
7+
RUN mkdir /functionaltestbot
8+
9+
EXPOSE 443
10+
# EXPOSE 2222
11+
12+
COPY ./functionaltestbot /functionaltestbot
13+
COPY setup.py /
14+
COPY test.sh /
15+
# RUN ls -ltr
16+
# RUN cat prestart.sh
17+
# RUN cat main.py
18+
19+
ENV FLASK_APP=/functionaltestbot/app.py
20+
ENV LANG=C.UTF-8
21+
ENV LC_ALL=C.UTF-8
22+
ENV PATH ${PATH}:/home/site/wwwroot
23+
24+
WORKDIR /
25+
26+
# Initialize the bot
27+
RUN pip3 install -e .
28+
29+
# ssh
30+
ENV SSH_PASSWD "root:Docker!"
31+
RUN apt-get update \
32+
&& apt-get install -y --no-install-recommends dialog \
33+
&& apt-get update \
34+
&& apt-get install -y --no-install-recommends openssh-server \
35+
&& echo "$SSH_PASSWD" | chpasswd \
36+
&& apt install -y --no-install-recommends vim
37+
COPY sshd_config /etc/ssh/
38+
COPY init.sh /usr/local/bin/
39+
RUN chmod u+x /usr/local/bin/init.sh
40+
41+
# For Debugging, uncomment the following:
42+
# ENTRYPOINT ["python3.6", "-c", "import time ; time.sleep(500000)"]
43+
ENTRYPOINT ["init.sh"]
44+
45+
# For Devops, they don't like entry points. This is now in the devops
46+
# pipeline.
47+
# ENTRYPOINT [ "flask" ]
48+
# CMD [ "run", "--port", "3978", "--host", "0.0.0.0" ]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
FROM python:3.7-slim as pkg_holder
5+
6+
ARG EXTRA_INDEX_URL
7+
RUN pip config set global.extra-index-url "${EXTRA_INDEX_URL}"
8+
9+
COPY requirements.txt .
10+
RUN pip download -r requirements.txt -d packages
11+
12+
FROM python:3.7-slim
13+
14+
ENV VIRTUAL_ENV=/opt/venv
15+
RUN python3.7 -m venv $VIRTUAL_ENV
16+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
17+
18+
COPY . /app
19+
WORKDIR /app
20+
21+
COPY --from=pkg_holder packages packages
22+
23+
RUN pip install -r requirements.txt --no-index --find-links=packages && rm -rf packages
24+
25+
ENTRYPOINT ["python"]
26+
EXPOSE 3978
27+
CMD ["runserver.py"]

libraries/functional-tests/functionaltestbot/README.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

libraries/functional-tests/functionaltestbot/application.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

libraries/functional-tests/functionaltestbot/bots/echo_bot.py

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Client Driver for Function E2E test
2+
3+
This contains the client code that drives the bot functional test.
4+
5+
It performs simple operations against the bot and validates results.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
from .echo_bot import EchoBot
4+
from .app import APP
55

6-
__all__ = ["EchoBot"]
6+
__all__ = ["APP"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
"""Bot app with Flask routing."""
5+
6+
from flask import Response
7+
8+
from .bot_app import BotApp
9+
10+
11+
APP = BotApp()
12+
13+
14+
@APP.flask.route("/api/messages", methods=["POST"])
15+
def messages() -> Response:
16+
return APP.messages()
17+
18+
19+
@APP.flask.route("/api/test", methods=["GET"])
20+
def test() -> Response:
21+
return APP.test()

0 commit comments

Comments
 (0)