Skip to content

Commit 4dec9bf

Browse files
authored
Merge pull request PHOENIXCONTACT#887 from PHOENIXCONTACT/update/reactivate-tests
Reactivate Tests
2 parents ee54ab1 + 20865a6 commit 4dec9bf

File tree

6 files changed

+73
-60
lines changed

6 files changed

+73
-60
lines changed

.github/workflows/build-and-test.yml

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ name: CI
33
# Controls when the action will run. Triggers the workflow on push or pull request
44
on:
55
push:
6-
branches:
6+
branches:
77
- dev
88
- future
99
tags:
1010
- v[0-9]+.[0-9]+.[0-9]+ # Matches all semantic versioning tags with major, minor, patch
1111
pull_request:
12-
branches:
12+
branches:
1313
- dev
1414
- future
1515

1616
env:
17-
dotnet_sdk_version: '10.0.100'
17+
dotnet_sdk_version: "10.0.100"
1818
REPOSITORY_NAME: ${{ github.event.repository.name }}
19-
MORYX_PACKAGE_TARGET_DEV: 'https://www.myget.org/F/moryx-oss-ci/api/v2/package'
20-
MORYX_PACKAGE_TARGET_V3_DEV: 'https://www.myget.org/F/moryx-oss-ci/api/v3/index.json'
21-
MORYX_PACKAGE_TARGET_FUTURE: 'https://www.myget.org/F/moryx-oss-ci/api/v2/package'
22-
MORYX_PACKAGE_TARGET_V3_FUTURE: 'https://www.myget.org/F/moryx-oss-ci/api/v3/index.json'
23-
MORYX_PACKAGE_TARGET_RELEASE: 'https://api.nuget.org/v3/index.json'
24-
MORYX_PACKAGE_TARGET_V3_RELEASE: 'https://api.nuget.org/v3/index.json'
19+
MORYX_PACKAGE_TARGET_DEV: "https://www.myget.org/F/moryx-oss-ci/api/v2/package"
20+
MORYX_PACKAGE_TARGET_V3_DEV: "https://www.myget.org/F/moryx-oss-ci/api/v3/index.json"
21+
MORYX_PACKAGE_TARGET_FUTURE: "https://www.myget.org/F/moryx-oss-ci/api/v2/package"
22+
MORYX_PACKAGE_TARGET_V3_FUTURE: "https://www.myget.org/F/moryx-oss-ci/api/v3/index.json"
23+
MORYX_PACKAGE_TARGET_RELEASE: "https://api.nuget.org/v3/index.json"
24+
MORYX_PACKAGE_TARGET_V3_RELEASE: "https://api.nuget.org/v3/index.json"
2525

2626
jobs:
2727
EnvVar:
@@ -45,35 +45,35 @@ jobs:
4545
dotnet_sdk_version: ${{ needs.EnvVar.outputs.dotnet_sdk_version }}
4646
REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
4747

48-
# UnitTests:
49-
# needs: [EnvVar, Build]
50-
# uses: phoenixcontact/tools/.github/workflows/unittest-tool.yml@main
51-
# with:
52-
# dotnet_sdk_version: ${{ needs.EnvVar.outputs.dotnet_sdk_version }}
53-
# REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
54-
#
55-
# IntegrationTests:
56-
# needs: [EnvVar, Build]
57-
# uses: phoenixcontact/tools/.github/workflows/integrationtest-tool.yml@main
58-
# with:
59-
# dotnet_sdk_version: ${{ needs.EnvVar.outputs.dotnet_sdk_version }}
60-
# REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
61-
#
62-
# ReportGenerator:
63-
# needs: [EnvVar, UnitTests, IntegrationTests]
64-
# uses: phoenixcontact/tools/.github/workflows/reportgenerator-tool.yml@main
65-
# with:
66-
# REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
67-
#
68-
# Publish-Test-Coverage:
69-
# needs: [EnvVar, ReportGenerator]
70-
# uses: phoenixcontact/tools/.github/workflows/publish-test-coverage-tool.yml@main
71-
# with:
72-
# REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
73-
# secrets:
74-
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
75-
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
76-
#
48+
UnitTests:
49+
needs: [EnvVar, Build]
50+
uses: phoenixcontact/tools/.github/workflows/unittest-tool.yml@main
51+
with:
52+
dotnet_sdk_version: ${{ needs.EnvVar.outputs.dotnet_sdk_version }}
53+
REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
54+
55+
IntegrationTests:
56+
needs: [EnvVar, Build]
57+
uses: phoenixcontact/tools/.github/workflows/integrationtest-tool.yml@main
58+
with:
59+
dotnet_sdk_version: ${{ needs.EnvVar.outputs.dotnet_sdk_version }}
60+
REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
61+
62+
ReportGenerator:
63+
needs: [EnvVar, UnitTests, IntegrationTests]
64+
uses: phoenixcontact/tools/.github/workflows/reportgenerator-tool.yml@main
65+
with:
66+
REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
67+
68+
Publish-Test-Coverage:
69+
needs: [EnvVar, ReportGenerator]
70+
uses: phoenixcontact/tools/.github/workflows/publish-test-coverage-tool.yml@main
71+
with:
72+
REPOSITORY_NAME: ${{ needs.EnvVar.outputs.REPOSITORY_NAME }}
73+
secrets:
74+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
75+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
76+
7777
# currently not working
7878
# Documentation:
7979
# needs: [EnvVar, UnitTests]
@@ -93,6 +93,6 @@ jobs:
9393
MORYX_PACKAGE_TARGET_V3_FUTURE: ${{ needs.EnvVar.outputs.MORYX_PACKAGE_TARGET_V3_FUTURE }}
9494
MORYX_PACKAGE_TARGET_RELEASE: ${{ needs.EnvVar.outputs.MORYX_PACKAGE_TARGET_RELEASE }}
9595
MORYX_PACKAGE_TARGET_V3_RELEASE: ${{ needs.EnvVar.outputs.MORYX_PACKAGE_TARGET_V3_RELEASE }}
96-
secrets:
96+
secrets:
9797
MYGET_TOKEN: ${{secrets.MYGET_TOKEN}}
9898
NUGET_TOKEN: ${{secrets.NUGET_TOKEN}}

src/Moryx.ControlSystem.ProcessEngine/Processes/ProcessStorage.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,15 @@ public void SaveProcess(ProcessData processData)
287287
entity = processRepository.GetByKey(processData.Id);
288288
}
289289
else
290-
{
291-
entity = processRepository.Create();
292-
entity.Id = processData.Id;
293-
entity.TypeName = processData.Process.GetType().Name;
294-
entity.State = (int)processData.State;
295-
entity.JobId = processData.Job.Id;
290+
{
291+
// Do not use Repository.Create here because id is self-generated.
292+
entity = uow.DbContext.Processes.Add(new ProcessEntity
293+
{
294+
Id = processData.Id,
295+
TypeName = processData.Process.GetType().Name,
296+
State = (int)processData.State,
297+
JobId = processData.Job.Id,
298+
}).Entity;
296299
}
297300
entity.State = (int)processData.State;
298301
entity.Rework = processData.Rework;
@@ -361,11 +364,15 @@ private void SaveActivity(IUnitOfWork<ProcessContext> uow, ActivityData activity
361364
}
362365
else
363366
{
364-
dbActivity = activityRepo.Create();
365-
dbActivity.Id = activity.Id;
366-
dbActivity.TaskId = activityData.Task.Id;
367-
dbActivity.ResourceId = activityData.Resource.Id;
368-
dbActivity.ProcessId = activityData.ProcessData.Id;
367+
// Do not use Repository.Create here because id is self-generated.
368+
dbActivity = new()
369+
{
370+
Id = activity.Id,
371+
TaskId = activityData.Task.Id,
372+
ResourceId = activityData.Resource.Id,
373+
ProcessId = activityData.ProcessData.Id,
374+
};
375+
uow.DbContext.Activities.Add(dbActivity);
369376
}
370377

371378
// UpdateList tracing info

src/Moryx.Drivers.OpcUa/Properties/AssemblyInfos.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
using System.Runtime.CompilerServices;
55

6-
[assembly: InternalsVisibleTo("Moryx.Drivers.OpcUa.Tests")]
6+
[assembly: InternalsVisibleTo("Moryx.Drivers.OpcUa.Tests")]
7+
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

src/Moryx.Operators.Management/Implementation/OperatorManager.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Moryx.Model.Repositories;
66
using Moryx.Operators.Management.Model;
77
using Moryx.AbstractionLayer.Resources;
8+
using Moryx.Model;
89

910
namespace Moryx.Operators.Management;
1011

@@ -86,7 +87,9 @@ public void Start()
8687
{
8788
using var uow = UnitOfWorkFactory.Create();
8889
var operatorRepo = uow.GetRepository<IOperatorEntityRepository>();
89-
var restored = operatorRepo.GetAll().Select(e => OperatorStorage.Load(e, ResourceManagement));
90+
var restored = operatorRepo.Linq.Active().ToArray()
91+
.Select(e => OperatorStorage.Load(e, ResourceManagement));
92+
9093
_operators.AddRange(restored);
9194
}
9295

src/Tests/Moryx.ControlSystem.ProcessEngine.Tests/Processes/ProcessStorageTests.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,16 @@ private ProcessData CreateProcessData(long jobId, long processId)
387387

388388
private static ProcessEntity CreateProcessEntity(IUnitOfWork<ProcessContext> uow, string typeName, int state, long jobId)
389389
{
390-
var processRepo = uow.GetRepository<IProcessEntityRepository>();
391-
392-
var processEntity = processRepo.Create();
393-
processEntity.Id = IdShiftGenerator.Generate(jobId << 14, ProcessTestsBase.NextId);
394-
processEntity.TypeName = typeName;
395-
processEntity.State = state;
396-
processEntity.JobId = jobId;
390+
// Do not use Repository.Create here because id is self-generated.
391+
var process = uow.DbContext.Processes.Add(new()
392+
{
393+
Id = IdShiftGenerator.Generate(jobId << 14, ProcessTestsBase.NextId),
394+
TypeName = typeName,
395+
State = state,
396+
JobId = jobId,
397+
});
397398

398-
return processEntity;
399+
return process.Entity;
399400
}
400401

401402
private static JobEntity CreateJobEntity(IUnitOfWork uow)

src/Tests/Moryx.Simulation.Tests/SimulatedDummyTestDriver.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public virtual void Send(object payload)
6464

6565
public virtual Task SendAsync(object payload, CancellationToken cancellationToken = default)
6666
{
67+
Send(payload);
6768
return Task.CompletedTask;
6869
}
6970

0 commit comments

Comments
 (0)