Okay I'm stumped on this one....ColdBox 6.8.1 (I'v...
# box-products
n
Okay I'm stumped on this one....ColdBox 6.8.1 (I've tried a few different revs, same problem) and TestBox 4.0.0 or 4.5.0 (same problem with both versions). The ColdBox app itself seems to start up fine. However when I to run my tests via /tests/runner.cfm I'm getting the error seen here. Any ideas? It's as if variables.log isn't getting constructed properly?
b
@nolanerck Can you show the test code and the stack trace of the error?
There are also two different errors shown there. One that's part of a test failure and one that's a global bundle failure which is happening after the tests
n
It's happening both on tests and on entirely empty Test CFC files. This one throws the same error:
Copy code
component extends="coldbox.system.testing.BaseTestCase" appMapping="/" {

	function run(){

		describe( "DateUtils Suite", function(){
        });
    }

}
Stack trace:
I should add, this is happening -after- any passing tests in the CFC complete.
b
Right, it's in the shutdown phase
n
correct.
b
It would appear the framework isn't starting up fully, or you have mocked portions of the framework in an integration test that leaves them inoperable.
n
Could this be caused by a bad mapping somewhere else? Perhaps an incorrect setting in box.json?
b
Dunno, it works for me
I just spun up a quick test site and pasted in your test code above and it passes
Copy code
goto sandbox
mkdir nolantest --cd
coldbox create app
start cfengine=lucee@5.3.8
!code .
// pasted in spec CFC here
testbox run
n
If I'm reading your above message correctly, this is because of an Integration test we have somewhere that's causing it to go sideways?
b
Dunno, but it is safe to say your local setup is probably more complex than the single spec code you posted šŸ™‚
Since, as I showed, that bundle in a vacuum runs without issues
n
Yeah the DevOps guy rebuilt a bunch of stuff this week. It's all Docker and AWS and tons of magic that I'm still walking thru.
b
I would isolate and see if any test run in isolation gets this issue. or only when certain combinations are run
n
What's weird tho, if it is an Integration test, is even when I click on a specific Test CFC to run just that one, it still causes this error.
Even when no Integration tests should be running.
b
Not sure what you mean when you say "no integration tests should be running", The test code you pasted above is an integration test.
Or at least, it extends
coldbox.system.testing.BaseTestCase
which will load and unload the ColdBox framework before and after the test
n
Hmmm...that should have been an (empty) unit test.
b
Unit tests don't generally extend
coldbox.system.testing.BaseTestCase
n
Ahhh!
b
That doesn't explain the error really FWIW
n
We must have had a copy/paste error no one saw
I've switched it to use "extends="testbox.system.BaseSpec""
Which....doesn't seem to help. šŸ˜•
b
I'd need to see the stack trace
BaseSpec has zero ColdBox-specific logic in it
n
Tests still pass, but that error about log.error is still popping up too.
b
So there's no way any test extending base spec is touching coldbox
This may be related to your test runner
n
It's just the stock runner.cfm that comes with TestBox.
b
Luis added some new stuff there recently in relation to ColdBox's "virtual apps"
n
We haven't changed anything (to my knowledge)
b
Right, and that could be the problem, lol
n
Same error happens if I go here too: http://localhost/tests/index.cfm
fwiw
b
If you have an older runner setup and a newer version of ColdBox/TestBox that may be an issue
But I have really no idea how any of this newer virtual app stuff works, so that's a @lmajano question
But I can tell you the latest app templates don't have the same code as whatever you're using
And the end of the day, your tests are somehow/somewhere creating
application.cbcontroller
but it has parts of it removed and replaced with non-working CFCs
Without seeing your full test suite, I really can't begin to guess what you have going on
Perhaps in an integration test somewhere, you're taking core services and injecting them with mocked versions of LogBox? Hard to say.
n
I've now deleted every single test except that DateUtils one...and I still get the error. šŸ™‚
There's an application.cfc in the /tests folder as expected, it's just the default one.
Aha!
I think I see something....
My current tests/application.cfc looks like so:
Copy code
component{

	// APPLICATION CFC PROPERTIES
	this.name 				= "ColdBoxTestingSuite" & hash(getCurrentTemplatePath());
	this.sessionManagement 	= true;
	this.sessionTimeout 	= createTimeSpan( 0, 0, 15, 0 );
	this.applicationTimeout = createTimeSpan( 0, 0, 15, 0 );
	this.setClientCookies 	= true;
	this.datasource="myemcdev";	

	// Create testing mapping
	this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() );
	// Map back to its root
	rootPath = REReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" );
	this.mappings["/root"]   = rootPath;

	public void function onRequestEnd() {
		if( !isNull( application.cbController ) ){
			application.cbController.getLoaderService().processShutdown();
		}
		structDelete( application, "cbController" );
		structDelete( application, "wirebox" );
	}

}
I assume that onRequestEnd() ms incorrect? And got copy/pasted from something that it shouldn't have?
b
I have no idea. Not sure where you got it from
I mean, it's obviously the line that's erroring, but I don't know why
There's nothing inherently wrong with it per se if you expect your tests to be loading ColdBox up into memory and you want it to get shutdown.
I'm pretty sure that was never part of our standard test runner templates
The thing about the
Application.cfc
is, it's "your" code, meaning TestBox or ColdBox upgrades won't touch it. It gets committed to your repo and you manage it.
n
I thought this was the /tests/Application.cfc file that got installed as part of "box install testbox" but all I know for sure is that I didn't write it. heh
b
No
Only the
testbox
folder is installed with TestBox
The entire
tests
folder is not part of the testbox core
n
Yeah I'm seeing that now.
b
It usually comes from • a coldbox app template (
coldbox create app
, etc) • The
testbox generate harness
scaffolding command • manually created by someone
n
I'm looking at "coldbox create app" now.
that'd be my guess. Or we copy / pasted it from another app entirely and nobody remembers when/where
@bdw429s hypothetically, if we call the virtualapp.startup(), but we never call virtualapp.shutdown(), what would happen? (These are tests so they're not running on Production servers.)