Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Create_Language test fails when deployed to Azure #3714


User avatar
0
justinp created

Running a simple update to 4.1.3 Angular + Core. My first step is to download 4.1.3 and get it running in Azure, then we move our changes over once it is verified to run.

We've created a new database in Azure and run Update-Database EF command against it.

Our build fails during the tests on the Create_Language test. Is there a reason this would succeed locally, then fail when deployed?

Here's the test:

[Fact]
        public async Task Create_Language()
        {
            //Act
            var output = await _languageAppService.GetLanguageForEdit(new NullableIdDto(null));

            //Assert
            output.Language.Id.ShouldBeNull();
            output.LanguageNames.Count.ShouldBeGreaterThan(0);
            output.Flags.Count.ShouldBeGreaterThan(0);

            //Arrange
            var currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);
            var nonRegisteredLanguages = output.LanguageNames.Where(l => currentLanguages.All(cl => cl.Name != l.Value)).ToList();

            //Act
            var newLanguageName = nonRegisteredLanguages[RandomHelper.GetRandom(nonRegisteredLanguages.Count)].Value;
            await _languageAppService.CreateOrUpdateLanguage(
                new CreateOrUpdateLanguageInput
                {
                    Language = new ApplicationLanguageEditDto
                    {
                        Icon = output.Flags[RandomHelper.GetRandom(output.Flags.Count)].Value,
                        Name = newLanguageName
                    }
                });

            //Assert
            currentLanguages = await _languageManager.GetLanguagesAsync(AbpSession.TenantId);
            currentLanguages.Count(l => l.Name == newLanguageName).ShouldBe(1);
        }

Here's the error:

2017-08-13T18:46:40.7656928Z Failed   Company.Project.Tests.Localization.LanguageAppService_Tests.Create_Language
2017-08-13T18:46:40.7656928Z Error Message:
2017-08-13T18:46:40.7656928Z  Shouldly.ShouldAssertException : 0
2017-08-13T18:46:40.7656928Z     should be
2017-08-13T18:46:40.7656928Z 1
2017-08-13T18:46:40.7656928Z     but was not
2017-08-13T18:46:40.7656928Z Stack Trace:
2017-08-13T18:46:40.7656928Z    at Shouldly.ShouldlyCoreExtensions.AssertAwesomely[T](T actual, Func`2 specifiedConstraint, Object originalActual, Object originalExpected, Func`1 customMessage, String shouldlyMethod)
2017-08-13T18:46:40.7656928Z    at Shouldly.ShouldBeTestExtensions.ShouldBe[T](T actual, T expected, Func`1 customMessage)
2017-08-13T18:46:40.7656928Z    at Shouldly.ShouldBeTestExtensions.ShouldBe[T](T actual, T expected)
2017-08-13T18:46:40.7656928Z    at Akesotek.Apollo.Tests.Localization.LanguageAppService_Tests.<Create_Language>d__4.MoveNext() in d:\a\1\s\test\Akesotek.Apollo.Tests\Localization\LanguageAppService_Tests.cs:line 67
2017-08-13T18:46:40.7656928Z --- End of stack trace from previous location where exception was thrown ---
2017-08-13T18:46:40.7656928Z    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2017-08-13T18:46:40.7656928Z    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-08-13T18:46:40.7656928Z --- End of stack trace from previous location where exception was thrown ---
2017-08-13T18:46:40.7656928Z    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2017-08-13T18:46:40.7656928Z    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-08-13T18:46:40.7656928Z --- End of stack trace from previous location where exception was thrown ---
2017-08-13T18:46:40.7656928Z    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2017-08-13T18:46:40.7656928Z    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2017-08-13T18:47:21.8278038Z [xUnit.net 00:02:10.0703411]   Finished:    Company.Project.Tests

2 Answer(s)
  • User Avatar
    0
    justinp created

    I've disabled the test on line 67 and it passed.

    // currentLanguages.Count(l => l.Name == newLanguageName).ShouldBe(1);
    

    What is it about this line that will fail?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @JustinP,

    I assume this works locally, right ?

    Thanks.