Skip to content

Commit

Permalink
updates for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHess committed Oct 11, 2022
1 parent 58a0427 commit bb87f79
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 18 deletions.
1 change: 0 additions & 1 deletion Connectors/src/Redis/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ applications:
buildpacks:
- dotnet_core_buildpack
memory: 256M
random-route: true
env:
ASPNETCORE_ENVIRONMENT: Development
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand Down
1 change: 0 additions & 1 deletion Management/src/CloudFoundry/manifest-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ applications:
ASPNETCORE_ENVIRONMENT: Development
services:
- myMySqlService
random-route: true
1 change: 0 additions & 1 deletion Management/src/CloudFoundry/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ applications:
DOTNET_NOLOGO: true
services:
- myMySqlService
random-route: true
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ requests = "*"
ipdb = "*"

[requires]
python_version = "3.7"
python_version = "3.10"
18 changes: 12 additions & 6 deletions TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project's `behave` implementation requires Python 3. See [Installing Pytho

Two helper scripts, [behave.ps1](behave.ps1) and [behave.sh](behave.sh), are provided to simplify the setup and invocation of `behave`.
These wrappers:

1. install `pipenv` into the user's Python package install directory
1. create a Python virtual environment for the project using `pipenv`
1. install needed Python packages into the virtual environment
Expand Down Expand Up @@ -52,11 +53,11 @@ C:> copy user.ini.example user.ini
The example file's options are commented with descriptions.

One option you might want to enable is `windowed = yes`.
Setting this option will run backgrounded processes in their own dedicated windows, making it easier to follow a test's progress.
Setting this option will run background processes in their own dedicated windows, making it easier to follow a test's progress.

### Cloud Foundry

If you don't specify Clound Foundry credentials, it is assumed you are already logged in to a Cloud Foundry endpoint.
If you don't specify Cloud Foundry credentials, it is assumed you are already logged in to a Cloud Foundry endpoint.

You can configure credentials by setting the following options in `user.ini`:

Expand All @@ -67,7 +68,7 @@ You can configure credentials by setting the following options in `user.ini`:

Sample:

```
```text
[behave.userdata]
cf_apiurl = https://api.run.pcfone.io
cf_username = myuser
Expand All @@ -80,14 +81,16 @@ The `development` space will be used as the target from which to create addition

By default, each sample will use a dedicated space for its applications and services.
The space is named `{feature}-{sample}-{os}` where:

* `{feature}` is the feature name (the top directory node of the sample path)
* `{sample}` is the sample name (the bottom directory node of the sample path)
* `{os}` is one of: `windows`, `osx`, `linux` depending on the platform on which the tests are run

As an example, if running the sample `Connectors\src\RabbitMQ` on Windows, it will use the space `connectors-rabbitmq-windows`.

You can override this behavior by setting the `cf_space` option.
```

```text
cf_space = myspace
```

Expand All @@ -100,6 +103,7 @@ Running the Samples tests requires Python 3 and its corresponding `pip` package
Install [Chocolatey][choco_url].

Start a PowerShell as Administrator and run:

```dos
C:> choco install -y python3
```
Expand All @@ -109,15 +113,17 @@ C:> choco install -y python3
Install [Homebrew][brew_url].

Start a terminal and run:

```sh
$ brew install python3
```

### Ubuntu

Start a terminal and run:
```
$ sudo apt install -y python3 python3-pip

```sh
sudo apt install -y python3 python3-pip
```

[choco_url]: https://chocolatey.org/
Expand Down
4 changes: 2 additions & 2 deletions behave.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$BaseDir = $PSScriptRoot
$ReInitFlag = "reinit"
$OldPath = $Env:Path
$Env:Path += ";$Env:AppData\Python\Python38\Scripts"
$Env:Path += ";$Env:AppData\Python\Python310\Scripts"

function Command-Available {
param($Command)
Expand Down Expand Up @@ -44,7 +44,7 @@ try {
}
if (!(Env-Exists)) {
"installing env"
pipenv --three sync
pipenv sync
}

# run samples
Expand Down
2 changes: 1 addition & 1 deletion ci/templates/setup-tools-steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ steps:
- task: UsePythonVersion@0
displayName: 'Setup Python'
inputs:
versionSpec: 3.7.x
versionSpec: 3.10.x
- task: UseRubyVersion@0
displayName: 'Setup Ruby'
inputs:
Expand Down
4 changes: 1 addition & 3 deletions pysteel/cloudfoundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ def get_service_status(self, service_instance):
if 'Service instance {} not found'.format(service_instance) in str(e):
raise CloudFoundryObjectDoesNotExistError()
raise e
match = re.search(r'^status:\s+(.*)', cmd.stdout, re.MULTILINE)
match = re.search(r'\s*status:\s+(.*)', cmd.stdout, re.MULTILINE)
if match:
return match.group(1)
match = re.search(r'^service:\s+(.*)', cmd.stdout, re.MULTILINE)
return match.group(1)

def push_app(self, manifest):
"""
Expand Down
2 changes: 1 addition & 1 deletion pysteel/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def resolve_cf_args(context, args, cwd):
match = re.search(r'- name:\s+(\S+)', doc)
if match:
app = match.group(1)
args += ['--hostname', dns.resolve_hostname(context, app)]
# args += ['--hostname', dns.resolve_hostname(context, app)] <-- deprecated in cf cli v7, now requires use of cf map-route command


def resolve_uaac_args(context, args, cwd):
Expand Down
2 changes: 1 addition & 1 deletion pysteel/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def resolve_hostname(context, name):
host, domain = name.split('.', 1)
else:
host, domain = name, None
host = '{}-{}'.format(host, context.cf_space.replace('_', ''))
# host = '{}-{}'.format(host, context.cf_space.replace('_', '')) # now just using the app name
context.log.info('host -> {}'.format(host))
if domain:
domain = resolve_domainname(context, domain)
Expand Down

0 comments on commit bb87f79

Please sign in to comment.