Skip to content

Commit

Permalink
Fix Functional Tests (#13585)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtkech authored May 18, 2023
1 parent e295fae commit 2804b64
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 57 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/functional_all_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ jobs:
image: cypress/included:9.6.1
steps:
- uses: actions/checkout@v3
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- uses: actions/setup-node@v3
with:
node-version: "15"
# - name: Fix nuget restore issue
# run: |
# apt update && apt --only-upgrade install ca-certificates -y
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand All @@ -39,6 +40,10 @@ jobs:
image: cypress/included:9.6.1
steps:
- uses: actions/checkout@v3
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Fix nuget restore issue
run: |
apt update && apt --only-upgrade install ca-certificates -y
Expand Down Expand Up @@ -79,6 +84,10 @@ jobs:
OrchardCore__DatabaseProvider: "Postgres"
steps:
- uses: actions/checkout@v3
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Fix nuget restore issue
run: |
apt update && apt --only-upgrade install ca-certificates -y
Expand All @@ -95,7 +104,7 @@ jobs:
test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
src/OrchardCore.Cms.Web/App_Data/logs
retention-days: 3

test_functional_cms_mysql:
name: Functional Tests - CMS MySql
runs-on: ubuntu-latest
Expand All @@ -115,6 +124,10 @@ jobs:
OrchardCore__DatabaseProvider: "MySql"
steps:
- uses: actions/checkout@v3
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Fix nuget restore issue
run: |
apt update && apt --only-upgrade install ca-certificates -y
Expand Down Expand Up @@ -150,6 +163,10 @@ jobs:
OrchardCore__DatabaseProvider: "SqlConnection"
steps:
- uses: actions/checkout@v3
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Fix nuget restore issue
run: |
apt update && apt --only-upgrade install ca-certificates -y
Expand Down
4 changes: 2 additions & 2 deletions src/OrchardCore.Modules/OrchardCore.Alias/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace OrchardCore.Alias
{
public class Migrations : DataMigration
{
private IContentDefinitionManager _contentDefinitionManager;
private readonly IContentDefinitionManager _contentDefinitionManager;

public Migrations(IContentDefinitionManager contentDefinitionManager)
{
Expand All @@ -24,7 +24,7 @@ public int Create()

// NOTE: The Alias Length has been upgraded from 64 characters to 767.
// For existing SQL databases update the AliasPartIndex tables Alias column length manually.
// INFO: The Alias Length is now of 740 chars, but this is only used on a new installation.
// INFO: The Alias Length is now of 735 chars, but this is only used on a new installation.
SchemaBuilder.CreateMapIndexTable<AliasPartIndex>(table => table
.Column<string>("Alias", col => col.WithLength(AliasPart.MaxAliasLength))
.Column<string>("ContentItemId", c => c.WithLength(26))
Expand Down
7 changes: 4 additions & 3 deletions src/OrchardCore.Modules/OrchardCore.Alias/Models/AliasPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ namespace OrchardCore.Alias.Models
{
public class AliasPart : ContentPart
{
// Maximum length that MySql can support in an index under utf8 collation is 768,
// minus 1 for the `DocumentId` integer (character size = integer size = 4 bytes),
// Maximum length that MySql can support in an index under utf8mb4 collation is 768,
// minus 2 for the `DocumentId` integer (bigint size = 8 bytes = 2 character size),
// minus 26 for the `ContentItemId` and 1 for the 'Published' and 'Latest' bools.
public const int MaxAliasLength = 740;
// minus 4 to allow at least to add a new integer column.
public const int MaxAliasLength = 735;

public string Alias { get; set; }
}
Expand Down
8 changes: 4 additions & 4 deletions src/OrchardCore.Modules/OrchardCore.Workflows/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Migrations : DataMigration
public int Create()
{
SchemaBuilder.CreateMapIndexTable<WorkflowTypeIndex>(table => table
.Column<string>("WorkflowTypeId")
.Column<string>("WorkflowTypeId", c => c.WithLength(26))
.Column<string>("Name")
.Column<bool>("IsEnabled")
.Column<bool>("HasStart")
Expand Down Expand Up @@ -43,9 +43,9 @@ public int Create()
);

SchemaBuilder.CreateMapIndexTable<WorkflowIndex>(table => table
.Column<string>("WorkflowTypeId")
.Column<string>("WorkflowId")
.Column<string>("WorkflowStatus")
.Column<string>("WorkflowTypeId", c => c.WithLength(26))
.Column<string>("WorkflowId", c => c.WithLength(26))
.Column<string>("WorkflowStatus", c => c.WithLength(26))
.Column<DateTime>("CreatedUtc")
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,8 @@ global.log = function(msg) {

// Build the dotnet application in release mode
function build(dir, dotnetVersion) {
global.log("version: 3");

// "dotnet" command arguments.
let runArgs = [
'build',
'--configuration', 'Release',
'--framework', dotnetVersion
];

// "dotnet" process options.
let runOpts = {
cwd: dir
};

try {
// Run dotnet build process, blocks until process completes.
let { status, error, stderr, stdout } = child_process.spawnSync('dotnet', runArgs, runOpts);

if (error) {
throw error;
}

if (status !== 0) {
if (stderr.length > 0) {
throw new Error(stderr.toString());
}
throw new Error(stdout.toString());
}

console.log(stdout.toString());
console.log('Build successful.');
}
catch (error) {
console.error(error);
console.error('Failed to build.');
}
global.log("Building ...");
child_process.spawnSync("dotnet", ["build", "-c", "Release", "-f", dotnetVersion], { cwd: dir });
}

// destructive action that deletes the App_Data folder
Expand All @@ -65,11 +31,11 @@ function host(dir, assembly, { appDataLocation='./App_Data', dotnetVersion='net7
} else {
build(dir, dotnetVersion);
}
global.log("Starting application ...");
global.log("Starting application ...");

const ocEnv = {};
ocEnv["ORCHARD_APP_DATA"] = appDataLocation;

let server = child_process.spawn(
"dotnet",
[`bin/Release/${dotnetVersion}/` + assembly],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ global.log = function(msg) {
};

// Build the dotnet application in release mode
export function build(dir) {
export function build(dir, dotnetVersion) {
global.log("Building ...");
var result = child_process.spawnSync("dotnet", ["build", "-c", "Release"], { cwd: dir });
global.log("Built ...");
global.log(result.output);
child_process.spawnSync("dotnet", ["build", "-c", "Release", "-f", dotnetVersion], { cwd: dir });
}

// destructive action that deletes the App_Data folder
Expand All @@ -27,7 +25,7 @@ export function host(dir, assembly, { appDataLocation='./App_Data', dotnetVersio
if (fs.existsSync(path.join(dir, `bin/Release/${dotnetVersion}/`, assembly))) {
global.log("Application already built, skipping build");
} else {
build(dir);
build(dir, dotnetVersion);
}
global.log("Starting application ...");

Expand Down

0 comments on commit 2804b64

Please sign in to comment.